当前位置: 首页>>代码示例>>C++>>正文


C++ soap_init函数代码示例

本文整理汇总了C++中soap_init函数的典型用法代码示例。如果您正苦于以下问题:C++ soap_init函数的具体用法?C++ soap_init怎么用?C++ soap_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了soap_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: soap_init

void TCSoapRunnable::run()
{
    struct soap soap;
    soap_init(&soap);
    soap_set_imode(&soap, SOAP_C_UTFSTRING);
    soap_set_omode(&soap, SOAP_C_UTFSTRING);

    // check every 3 seconds if world ended
    soap.accept_timeout = 3;
    soap.recv_timeout = 5;
    soap.send_timeout = 5;
    if (!soap_valid_socket(soap_bind(&soap, _host.c_str(), _port, 100)))
    {
        TC_LOG_ERROR("network.soap", "Couldn't bind to %s:%d", _host.c_str(), _port);
        exit(-1);
    }

    TC_LOG_INFO("network.soap", "Bound to http://%s:%d", _host.c_str(), _port);

    while (!World::IsStopped())
    {
        if (!soap_valid_socket(soap_accept(&soap)))
            continue;   // ran into an accept timeout

        TC_LOG_DEBUG("network.soap", "Accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
        struct soap* thread_soap = soap_copy(&soap);// make a safe copy

        ACE_Message_Block* mb = new ACE_Message_Block(sizeof(struct soap*));
        ACE_OS::memcpy(mb->wr_ptr(), &thread_soap, sizeof(struct soap*));
        process_message(mb);
    }

    soap_done(&soap);
}
开发者ID:Caydan,项目名称:WoWSCore548,代码行数:34,代码来源:TCSoap.cpp

示例2: main

int main(int argc, char* argv[])
{
	int m, s; /**//* master and slave sockets */
	struct soap sop;
	soap_init(&sop);
	
	if (argc < 2) {
		printf("usage:%s <server_port>\n", argv[0]);
		goto failed;
	}

	m = soap_bind(&sop, NULL, atoi(argv[1]), 100);
	if (m < 0) {
		soap_print_fault(&sop, stderr);
		goto failed;
	}
	fprintf(stderr, "Socket connection successful: master socket = %d\n", m);

	for ( ; ; ) {
		s = soap_accept(&sop);
		if (s < 0) {
			soap_print_fault(&sop, stderr);
			goto failed;
		}
		fprintf(stderr, "Socket connection successful: slave socket = %d\n", s);
		soap_serve(&sop);
		soap_end(&sop);
	}
	return 0;

failed:
	return 1;
}
开发者ID:beback1986,项目名称:MyGitProject,代码行数:33,代码来源:test.cpp

示例3: TCSoapThread

void TCSoapThread(const std::string& host, uint16 port)
{
    struct soap soap;
    soap_init(&soap);
    soap_set_imode(&soap, SOAP_C_UTFSTRING);
    soap_set_omode(&soap, SOAP_C_UTFSTRING);

    // check every 3 seconds if world ended
    soap.accept_timeout = 3;
    soap.recv_timeout = 5;
    soap.send_timeout = 5;
    if (!soap_valid_socket(soap_bind(&soap, host.c_str(), port, 100)))
    {
        TC_LOG_ERROR("network.soap", "Couldn't bind to %s:%d", host.c_str(), port);
        exit(-1);
    }

    TC_LOG_INFO("network.soap", "Bound to http://%s:%d", host.c_str(), port);

    while (!World::IsStopped())
    {
        if (!soap_valid_socket(soap_accept(&soap)))
            continue;   // ran into an accept timeout

        TC_LOG_DEBUG("network.soap", "Accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
        struct soap* thread_soap = soap_copy(&soap);// make a safe copy
        process_message(thread_soap);
    }

    soap_done(&soap);
}
开发者ID:Abrek,项目名称:My-WoDCore-6.x.x,代码行数:31,代码来源:TCSoap.cpp

示例4: init_gsoap

/**
 * gSOAP
 */
static void
init_gsoap (struct soap *p_soap)
{
	/* Initialize gSOAP */
	soap_init (p_soap);
	soap_set_namespaces (p_soap, simias_namespaces);
}
开发者ID:ifolder,项目名称:simias,代码行数:10,代码来源:simiasweb.c

示例5: main

int main(int argc, char**argv)
{ 


   struct soap soap; 
   int m, s;
   size = 0;
   soap_init(&soap); 
   m = soap_bind(&soap, hostname, port, 100); 
   if (m < 0) 
      soap_print_fault(&soap, stderr); 
   else
   { 
     fprintf(stderr, "Socket connection successful: master socket = %d; port = %d\n", m, port); 
      int i;
      for (i = 1; ; i++) 
      {
         s = soap_accept(&soap); 
         if (s < 0) 
         { 
            soap_print_fault(&soap, stderr); 
            break; 
         } 
         fprintf(stderr, "%d: accepted connection from IP=%d.%d.%d.%d socket=%d", i, 
            (soap.ip >> 24)&0xFF, (soap.ip >> 16)&0xFF, (soap.ip >> 8)&0xFF, soap.ip&0xFF, s); 
         if (soap_serve(&soap) != SOAP_OK)
            soap_print_fault(&soap, stderr);
         fprintf(stderr, "request served\n"); 
         soap_destroy(&soap);
         soap_end(&soap);
      } 
   } 
   soap_done(&soap);
} 
开发者ID:Thundzz,项目名称:ApplicationsReparties,代码行数:34,代码来源:server.c

示例6: getRequestStatus

//srm_array_of_strings getProtocols( srm_host_info host_info );
//
RequestStatus getRequestStatus( srm_int       requestId,
				srm_host_info host_info )
{
  char srmurl[SRM_MAX_URL_LEN];
  RequestStatus rs = NULL;

  if( fillSrmUrl( srmurl, host_info) ) {
    int ret;
    class tns__getRequestStatusResponse out;
    {
      struct soap soap;
      soap_init(&soap);

      ret = soap_call_tns__getRequestStatus( &soap, 
		 (const char*)srmurl, "getRequestStatus", (int)requestId, &out );
      if ( ret ) 
	soap_print_fault( &soap, stderr );
      else
	rs = g2srm_RequestStatus( out._Result );

      soap_end(  &soap );
      soap_done( &soap );
    }
  }
  return rs;
}
开发者ID:AndyMN,项目名称:dcache,代码行数:28,代码来源:srmImpl.cpp

示例7: get

RequestStatus get( srm_array_of_strings surls,
		   srm_array_of_strings protocols,
		   srm_host_info        host_info )
{
  char srmurl[SRM_MAX_URL_LEN];
  RequestStatus rs = NULL;

  if( fillSrmUrl( srmurl, host_info) ) {
    int   ret;
    class tns__getResponse out;

    class ArrayOfstring *arg0 = srm2g_string_array( surls );
    class ArrayOfstring *arg1 = srm2g_string_array( protocols );

    {
      struct soap soap;
      
      soap_init( &soap );
      
      ret = soap_call_tns__get ( &soap, (const char*)srmurl, "get", 
				 arg0, arg1, &out);
      if ( ret == SOAP_OK )
	rs = g2srm_RequestStatus( out._Result );
      else
	soap_print_fault( &soap, stderr );
      
      soap_end(  &soap );
      soap_done( &soap );
    }
    freeArrayOfstring( arg0 );
    freeArrayOfstring( arg1 );
  }
  return rs;
}
开发者ID:AndyMN,项目名称:dcache,代码行数:34,代码来源:srmImpl.cpp

示例8: soap_init

CWebServiceApi::CWebServiceApi()
{
    m_soap_endpoint = "";
    soap_init(&clientSOAP);
    setlocale(LC_ALL,"chs");
    soap_set_mode(&clientSOAP,SOAP_C_MBSTRING);
}
开发者ID:lidongqiang,项目名称:PCBATool,代码行数:7,代码来源:WebServiceApi.cpp

示例9: setFileStatus

RequestStatus setFileStatus ( srm_int       requestId,
			      srm_int       fileId,
			      srm_string    state,
			      srm_host_info host_info )
{
  char *statestr = (char*) state;
  char  srmurl[SRM_MAX_URL_LEN];
  class tns__setFileStatusResponse out;

  RequestStatus rs = NULL;

  if(    strcmp("Failed",  statestr)
      && strcmp("Pending", statestr)
      && strcmp("Ready",   statestr)
      && strcmp("Running", statestr)
      && strcmp("Done",    statestr) 
  )
    return NULL;     /* String NOT found, the state is invalid, just do nothing */

  if( fillSrmUrl( srmurl,  host_info)  ) {
    struct soap soap;
    soap_init(&soap);
    
    if ( soap_call_tns__setFileStatus ( &soap, (const char*)srmurl, "setFileStatus",
					(int)requestId, (int)fileId, state, &out))
      soap_print_fault( &soap, stderr );
    else
      rs = g2srm_RequestStatus( out._Result );

    soap_end(  &soap );
    soap_done( &soap );
  }
  return rs;
}
开发者ID:AndyMN,项目名称:dcache,代码行数:34,代码来源:srmImpl.cpp

示例10: rmc_init

	static int
rmc_init (struct soap *soap, char *errbuf, int errbufsz)
{
	int flags;

	soap_init (soap);
	soap->namespaces = namespaces_rmc;

	if (rmc_endpoint == NULL && (rmc_endpoint = getenv ("RMC_ENDPOINT")) == NULL) {
		if (!gfal_is_nobdii ()) {
			if (get_rls_endpoints (&lrc_endpoint, &rmc_endpoint, errbuf, errbufsz) != 0) {
				errno = EINVAL;
				return (-1);
			}
		} else {
			gfal_errmsg (errbuf, errbufsz, GFAL_ERRLEVEL_ERROR,
					"You have to define 'RMC_ENDPOINT' and 'LRC_ENDPOINT' environment variables, when BDII calls are disabled");
			errno = EINVAL;
			return (-1);
		}
	}

#ifdef GFAL_SECURE
	if (strncmp (rmc_endpoint, "https", 5) == 0) {
		flags = CGSI_OPT_SSL_COMPATIBLE;
		soap_register_plugin_arg (soap, client_cgsi_plugin, &flags);
	}
#endif
	gfal_errmsg (errbuf, errbufsz, GFAL_ERRLEVEL_ERROR,
			"RMC/LRC are obsolete! Please use LFC instead.");
	return (0);
}
开发者ID:ic-hep,项目名称:emi3,代码行数:32,代码来源:rmc_ifce.c

示例11: condor_base64_decode

// Caller needs to free *output if non-NULL
void condor_base64_decode(const char *input,unsigned char **output, int *output_length)
{
	ASSERT( input );
	ASSERT( output );
	ASSERT( output_length );
	int input_length = strlen(input);

		// safe to assume output length is <= input_length
	*output = (unsigned char *)malloc(input_length + 1);
	ASSERT( *output );
	memset(*output, 0, input_length);

	struct soap soap;
	soap_init(&soap);

	soap_base642s(&soap,input,(char*)(*output),input_length,output_length);

	soap_destroy(&soap);
	soap_end(&soap);
	soap_done(&soap);

	if( *output_length < 0 ) {
		free( *output );
		*output = NULL;
	}
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:27,代码来源:soapshell_main.cpp

示例12: condor_base64_encode

// Caller needs to free the returned pointer
char* condor_base64_encode(const unsigned char *input, int length)
{
	char *buff = NULL;

	if ( length < 1 ) {
		buff = (char *)malloc(1);
		buff[0] = '\0';
		return buff;
	}

	int buff_len = (length+2)/3*4+1;
	buff = (char *)malloc(buff_len);
	ASSERT(buff);
	memset(buff,0,buff_len);

	struct soap soap;
	soap_init(&soap);

	soap_s2base64(&soap,input,buff,length);

	soap_destroy(&soap);
	soap_end(&soap);
	soap_done(&soap);

	return buff;
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:27,代码来源:soapshell_main.cpp

示例13: main

int main()
{
  struct soap soap;
  int m, s; // master and slave sockets
  int i;

  soap_init(&soap);
  m = soap_bind(&soap, "127.0.0.1", 9111, 100);
  if (m < 0)
    soap_print_fault(&soap, stderr);
  else
    {
      fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
      for (i = 1; ; i++)
        {
          s = soap_accept(&soap);
          if (s < 0)
            {
              soap_print_fault(&soap, stderr);
              break;
            }

          fprintf(stderr,
                  "%d: accepted connection from IP=%d.%d.%d.%d socket=%d\n", i,
                  (soap.ip >> 24)&0xFF, (soap.ip>>16)&0xFF, (soap.ip>>8)&0xFF,
                  soap.ip&0xFF, s);
          if(soap_serve(&soap) != SOAP_OK) // process RPC request
            soap_print_fault(&soap, stderr); // print error
          fprintf(stderr,"request served\n");
          soap_destroy(&soap); // clean up class instances
          soap_end(&soap); // clean up everything and close socket
        }
    }
  soap_done(&soap); // close master socket and detach environment
}
开发者ID:AdaCore,项目名称:aws,代码行数:35,代码来源:c_server_rpc.c

示例14: main

int main(int argc, char **argv)
{ int m, s; /* master and slave sockets */
  struct soap soap;
  soap_init(&soap);
  if (argc < 2)
    soap_serve(&soap);	/* serve as CGI application */
  else
  { m = soap_bind(&soap, NULL, atoi(argv[1]), 100);
    if (m < 0)
    { soap_print_fault(&soap, stderr);
      exit(-1);
    }
    fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
    for ( ; ; )
    { s = soap_accept(&soap);
      fprintf(stderr, "Socket connection successful: slave socket = %d\n", s);
      if (s < 0)
      { soap_print_fault(&soap, stderr);
        exit(-1);
      } 
      soap_serve(&soap);
      soap_end(&soap);
    }
  }
  return 0;
} 
开发者ID:xin3liang,项目名称:platform_external_gsoap,代码行数:26,代码来源:calcserver.cpp

示例15: main

int main(int argc, char **argv)
{
int result = -1;
int id_count = 1;

struct Namespace namespaces[] =
{   // {"ns-prefix", "ns-name"}
   {"SOAP-ENV", "http://www.w3.org/2003/05/soap-envelope"}, // MUST be first
   {"d", "http://schemas.xmlsoap.org/ws/2005/04/discovery"}, 
   {"wsa", "http://schemas.xmlsoap.org/ws/2004/08/addressing"}, 
   {"dn", "http://www.onvif.org/ver10/network/wsdl"}, // given by the service description
   {NULL, NULL} // end of table
}; 
	 
	 // Get UUID
	 uuid_t uuid;
	 char szUuid[36] = {0};
	 char szMsgID[50] = {0};
	 
	 uuid_generate_time(uuid);
	 
	 uuid_unparse(uuid, szUuid);
	 
	 snprintf(szMsgID, sizeof(szMsgID), "uuid:%s", szUuid);
	 
struct soap soap;
struct SOAP_ENV__Header header; // the SOAP Header

soap_init(&soap);
soap.send_timeout = 1; // 1s timeout
soap.recv_timeout = 1; // 1s timeout

soap_set_namespaces(&soap, namespaces);

soap_default_SOAP_ENV__Header(&soap, &header); // init SOAP Header
header.wsa__MessageID = szMsgID;
header.wsa__To = "urn:schemas-xmlsoap-org:ws:2005:04:discovery";
header.wsa__Action = "http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe";

soap.header = &header;

struct d__ProbeMatchType r;
// Send and receive messages over UDP:
if (soap_send_d__Probe(&soap, "soap.udp://239.255.255.250:3702", NULL, "", ""))
{
      soap_print_fault(&soap, stderr);
}

// Send and receive messages over UDP:
if (soap_send_d__ProbeMatches(&soap, "soap.udp://239.255.255.250:3702", NULL, NULL))
{
      soap_print_fault(&soap, stderr);
}

soap_destroy(&soap); // cleanup
soap_end(&soap); // cleanup
soap_done(&soap); // close connection (should not use soap struct after this) 

return 0;
}
开发者ID:songsanghoon2,项目名称:wsdiscovery,代码行数:60,代码来源:wsclient.c


注:本文中的soap_init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。