• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ soap_print_fault函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run_serve

int run_serve(int port)
{ struct soap *soap = soap_new1(SOAP_ENC_MTOM); /* enable MTOM */
  int ret;
  if (!soap_valid_socket(soap_bind(soap, NULL, port, 100)))
    soap_print_fault(soap, stderr);
  else
  { fprintf(stderr, "Bind to port %d successful\n", port);
    soap->accept_timeout = 3600; /* let server time out after one hour */
    for (;;)
    { int sock = soap_accept(soap);
      if (!soap_valid_socket(sock))
      { if (soap->errnum)
          soap_print_fault(soap, stderr);
        else
          fprintf(stderr, "Server timed out\n");
        break;
      }
      fprintf(stderr, "Accepting socket %d connection from IP %d.%d.%d.%d... ", sock, (int)(soap->ip>>24)&0xFF, (int)(soap->ip>>16)&0xFF, (int)(soap->ip>>8)&0xFF, (int)soap->ip&0xFF);
      if (soap_serve(soap))
        soap_print_fault(soap, stderr);
      fprintf(stderr, "done\n");
      soap_destroy(soap);
      soap_end(soap);
    } 
  }
  ret = soap->error;
  soap_free(soap); /* done and free */
  return ret;
}
开发者ID:allenway,项目名称:onvif,代码行数:29,代码来源:mtom-test.c


示例2: listenPort

//监听指定端口,事件参考event.c
//用于监听IPC上线或下线、或响应客户探测
//timeout设置超时时间,>0单位为秒 =0 用不超时 <0单位为微秒
static int listenPort(int port,int timeout)
{
	struct soap *serv = soap_new1(SOAP_IO_UDP); // to invoke messages
	int ret;
	//绑定端口号
	if (!soap_valid_socket(soap_bind(serv,NULL,port, 100)))
	{ 
		soap_print_fault(serv, stderr);
		printf("soap_bind error\n");
  		ret = -1;
		goto ERR0;
	}
	//加入多播地址
	struct ip_mreq mreq;
    mreq.imr_multiaddr.s_addr = inet_addr("239.255.255.250");
    mreq.imr_interface.s_addr = htonl(INADDR_ANY);
    if (setsockopt(serv->socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0)
    {
		printf("add multiaddr is error\n");
    	goto ERR0;
    }
	//监听
	ret = soap_wsdd_listen(serv,timeout);
	if(ret!=SOAP_OK)
	{
		soap_print_fault(serv, stderr);
		printf("soap_wsdd_listen error,ret=%d\n",ret);
		goto ERR0;
	}
	printf("soap_wsdd_listen return\n");
ERR0:
	soap_end(serv);
	soap_free(serv);
	return ret;
}
开发者ID:allenway,项目名称:onvif,代码行数:38,代码来源:main.c


示例3: 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


示例4: 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


示例5: 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


示例6: 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


示例7: 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


示例8: main

int main(int argc, char **argv)
{ struct soap *soap;
  int m, s;
  soap = soap_new();
  if (argc < 3)
    soap_serve(soap); // run as CGI application over the Web
  else // run as stand-alone server on machine given by argv[1] listening to port argv[2]
  { m = soap_bind(soap, argv[1], atoi(argv[2]), 100);
    if (m < 0)
    { soap_print_fault(soap, stderr);
      exit(-1);
    }
    fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
    for (int i = 1; ; i++)
    { s = soap_accept(soap);
      if (s < 0)
      { soap_print_fault(soap, stderr);
        exit(-1);
      }
      fprintf(stderr, "%d: accepted connection from IP = %d.%d.%d.%d socket = %d ... ", i, (int)(soap->ip>>24)&0xFF, (int)(soap->ip>>16)&0xFF, (int)(soap->ip>>8)&0xFF, (int)soap->ip&0xFF, s);
      soap_serve(soap);		// process request
      fprintf(stderr, "request served\n");
      soap_destroy(soap);	// delete class instances
      soap_end(soap);		// clean up everything and close socket
    }
  }
  return 0;
}
开发者ID:xin3liang,项目名称:platform_external_gsoap,代码行数:28,代码来源:luserver.cpp


示例9: main

int main(int argc, char **argv) {
  // initialize EMBASSY info
  embInitPV("kclique", argc, argv, "KBWS", "1.0.9");

  struct soap soap;
  char*  jobid;
  char*  result;

  AjPFile    infile;
  AjPFile    outf;
  AjPStr     substr;
  AjPStr     indata = NULL;
  AjPStr     line   = NULL;

  infile = ajAcdGetInfile("infile");
  outf   = ajAcdGetOutfile("outfile");

  while (ajReadline(infile, &line)) {
    ajStrAppendS(&indata, line);
    ajStrAppendC(&indata, "\n");
  }

  soap_init(&soap);

  char* in0;
  in0 = ajCharNewS(indata);
  if ( soap_call_ns1__runClique( &soap, NULL, NULL, in0, &jobid ) == SOAP_OK ) {
  } else {
    soap_print_fault(&soap, stderr);
  }

  int check = 0;
  while ( check == 0 ) {
    if ( soap_call_ns1__checkStatus( &soap, NULL, NULL, jobid,  &check ) == SOAP_OK ) {
    } else {
      soap_print_fault(&soap, stderr);
    }
    sleep(3);
  }

  if ( soap_call_ns1__getResult( &soap, NULL, NULL, jobid,  &result ) == SOAP_OK ) {
    substr = ajStrNewC(result);
    ajFmtPrintF(outf,"%S\n",substr);
  } else {
    soap_print_fault(&soap, stderr);
  }

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

  ajFileClose(&infile);
  ajFileClose(&outf);
  ajStrDel(&substr);

  embExit();

  return 0;
}
开发者ID:agustin-avila,项目名称:KBWS,代码行数:59,代码来源:kclique.c


示例10: main

int main(int args, char* argv[]) 
{ 
  char *s; 
  jcl_ws w;

  soap_init1(w.soap, SOAP_ENC_MTOM); // MTOM  
  
//  w.endpoint = "http://mvs.open-bpm.org/mvsserver.cgi";

  if (args==3)
  {
    w.soap->userid = argv[1]; 
    w.soap->passwd = argv[2];
  } 

  if (w.jcl_ws__Ping(s) == SOAP_OK) 
    std::cout <<  s << std::endl; 
  else
  {
    soap_print_fault(w.soap, stderr); 
    return -1;
  }

  struct jcl_data__Payload jcl;

  openReadFile(w.soap, "input.txt", &jcl);

  writeFileName = "output.txt";
  
  // Alloc return Structure
  struct jcl_ws__jclResponse response;
  response._return = soap_new_jcl_ws__output(w.soap, -1);

  std::string param = "Test";
  
  // Call EchoTest
  w.soap->userid = argv[1]; 
  w.soap->passwd = argv[2];
  w.soap->fmimereadopen = readOpenCallback;
  w.soap->fmimereadclose = readCloseCallback;
  w.soap->fmimeread = readCallback;
  w.soap->fmimewriteopen = writeOpenCallback;
  w.soap->fmimewriteclose = writeCloseCallback;
  w.soap->fmimewrite = writeCallback;

  if ( w.jcl_ws__EchoTest(param, &jcl, response) == SOAP_OK ) 
    std::cout <<  "EchoTest OK" << std::endl; 
  else
  {
    soap_print_fault(w.soap, stderr); 
    return -1;
  }

  soap_destroy(w.soap);
  soap_end(w.soap);
  soap_done(w.soap);
                        
  return 0; 
}
开发者ID:adesutherland,项目名称:herchosting,代码行数:59,代码来源:mvsclient.cpp


示例11: main

int main()
{ struct soap soap;
  double a, b, result;
  /* Init SSL */
  soap_ssl_init();
  if (CRYPTO_thread_setup())
  { fprintf(stderr, "Cannot setup thread mutex for OpenSSL\n");
    exit(1);
  }
  a = 10.0;
  b = 20.0;
  /* Init gSOAP context */
  soap_init(&soap);
  /* The supplied server certificate "server.pem" assumes that the server is
    running on 'localhost', so clients can only connect from the same host when
    verifying the server's certificate. Use SOAP_SSL_NO_AUTHENTICATION to omit
    the authentication of the server and use encryption directly from any site.
    To verify the certificates of third-party services, they must provide a
    certificate issued by Verisign or another trusted CA. At the client-side,
    the capath parameter should point to a directory that contains these
    trusted (root) certificates or the cafile parameter should refer to one
    file will all certificates. To help you out, the supplied "cacerts.pem"
    file contains the certificates issued by various CAs. You should use this
    file for the cafile parameter instead of "cacert.pem" to connect to trusted
    servers.  Note that the client may fail to connect if the server's
    credentials have problems (e.g. expired). Use SOAP_SSL_NO_AUTHENTICATION
    and set cacert to NULL to encrypt messages if you don't care about the
    trustworthyness of the server.  Note: setting capath may not work on
    Windows.
  */
  if (soap_ssl_client_context(&soap,
    /* SOAP_SSL_NO_AUTHENTICATION, */ /* for encryption w/o authentication */
    /* SOAP_SSL_DEFAULT | SOAP_SSL_SKIP_HOST_CHECK, */	/* if we don't want the host name checks since these will change from machine to machine */
    SOAP_SSL_DEFAULT,	/* use SOAP_SSL_DEFAULT in production code */
    NULL, 		/* keyfile (cert+key): required only when client must authenticate to server (see SSL docs to create this file) */
    NULL, 		/* password to read the keyfile */
    "cacert.pem",	/* optional cacert file to store trusted certificates, use cacerts.pem for all public certificates issued by common CAs */
    NULL,		/* optional capath to directory with trusted certificates */
    NULL		/* if randfile!=NULL: use a file with random data to seed randomness */ 
  ))
  { soap_print_fault(&soap, stderr);
    exit(1);
  }
  soap.connect_timeout = 60;	/* try to connect for 1 minute */
  soap.send_timeout = soap.recv_timeout = 30;	/* if I/O stalls, then timeout after 30 seconds */
  if (soap_call_ns__add(&soap, server, "", a, b, &result) == SOAP_OK)
    fprintf(stdout, "Result: %f + %f = %f\n", a, b, result);
  else
    soap_print_fault(&soap, stderr);
  soap_destroy(&soap); /* C++ */
  soap_end(&soap);
  soap_done(&soap);
  CRYPTO_thread_cleanup();
  return 0;
}
开发者ID:JinpengLI,项目名称:gsoap,代码行数:55,代码来源:sslclient.c


示例12: run_server

int run_server(int port)
{ struct soap soap;
  int ret;
  /* Enable MTOM */
#ifdef WITH_GZIP
  soap_init1(&soap, SOAP_ENC_MTOM | SOAP_ENC_ZLIB); /* Enable MTOM */
#else
  soap_init1(&soap, SOAP_ENC_MTOM); 
#endif
  /* Set the MIME callbacks */
  soap.fmimereadopen = mime_read_open;
  soap.fmimereadclose = mime_read_close;
  soap.fmimeread = mime_read;
  soap.fmimewriteopen = mime_server_write_open;
  soap.fmimewriteclose = mime_server_write_close;
  soap.fmimewrite = mime_server_write;
  /* Bind socket */
  if (!soap_valid_socket(soap_bind(&soap, NULL, port, 100)))
    soap_print_fault(&soap, stderr);
  else
  { fprintf(stderr, "Bind to port %d successful\n", port);
    /* Optional: let server time out after one hour */
    soap.accept_timeout = 3600;
    /* Unix/Linux SIGPIPE, this is OS dependent:
    soap.accept_flags = SO_NOSIGPIPE;	// some systems like this
    soap.socket_flags = MSG_NOSIGNAL;	// others need this
    signal(SIGPIPE, sigpipe_handle);	// or a sigpipe handler (more portable)
    */
    /* Server loop */
    for (;;)
    { int sock = soap_accept(&soap);
      if (!soap_valid_socket(sock))
      { if (soap.errnum)
          soap_print_fault(&soap, stderr);
        else
        { fprintf(stderr, "Server timed out (see code how to change this)\n");
          break;
        }
      }
      fprintf(stderr, "Accepting socket %d connection from IP %d.%d.%d.%d... ", sock, (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
      if (soap_serve(&soap))
        soap_print_fault(&soap, stderr);
      fprintf(stderr, "done\n");
      soap_destroy(&soap);
      soap_end(&soap);
    } 
  }
  ret = soap.error;
  soap_destroy(&soap);
  soap_end(&soap);
  soap_done(&soap);
  return ret;
}
开发者ID:BioinformaticsArchive,项目名称:KBWS,代码行数:53,代码来源:mtom-stream-test.c


示例13: main

int main(int argc, char **argv)
{ struct soap *soap = soap_new();
  const char *endpoint;
  matrix a(soap, 3); // matrix with 3 rows created in current soap env.
  // set up matrix by specifying non-zero elements only (this is optional)
  a[1].resize(1,2); // 2-element vector indexed from 1 to 2
  a[1][1] = 2;
  a[1][2] = 1;
  a[2].resize(1,3); // 3-element vector
  a[2][1] = 1;
  a[2][2] = 2;
  a[2][3] = 1;
  a[3].resize(2,3); // 2-element vector indexed from 2 to 3
  a[3][2] = 1;
  a[3][3] = 2;
  cout << "* Demonstration example *" << endl;
  cout << "Matrix:" << endl;
  a.print();
  vector b(soap, 3);
  b[1] = 1;
  b[2] = 2;
  b[3] = 3;
  cout << "Vector:" << endl;
  b.print();
  vector x(soap);
  if (argc < 2)
    endpoint = luserver;
  else
    endpoint = argv[1];
  /* solve ax=b */
  if (soap_call_ns1__lusol(soap, endpoint, "", &a, &b, &x))
  { soap_print_fault(soap, stderr);
    soap_print_fault_location(soap, stderr);
  }
  else
  { cout << "Solution vector from service:" << endl;
    x.print();
  }
  matrix a1(soap);
  if (soap_call_ns1__luinv(soap, endpoint, "", &a, &a1))
  { soap_print_fault(soap, stderr);
    soap_print_fault_location(soap, stderr);
  }
  else
  { cout << "Inverse matrix matrix from service:" << endl;
    a1.print();
  }
  soap_destroy(soap);
  soap_end(soap);
  free(soap);
  return 0;
}
开发者ID:carriercomm,项目名称:PrologMUD,代码行数:52,代码来源:luclient.cpp


示例14: soap_new

Root::Root(const char *factory, enum t__object object, char *name)
{ soap = soap_new();
  endpoint = soap_strdup(soap, factory);
  status = FACTORY_NOTFOUND;
  if (name)
    if (soap_call_ns__lookup(soap, endpoint, "", object, name, status))
      soap_print_fault(soap, stderr);	// for demo, just print
  if (status == FACTORY_NOTFOUND)
    do
    { if (soap_call_ns__create(soap, endpoint, "", object, name, status))
        soap_print_fault(soap, stderr);	// for demo, just print
    } while (status == FACTORY_RETRY);
}
开发者ID:allenway,项目名称:onvif,代码行数:13,代码来源:factorytest.cpp


示例15: soap_init

/* Server loop */
void audioDB::startServer(){
  struct soap soap;
  int m, s; // master and slave sockets
  soap_init(&soap);
  // FIXME: largely this use of SO_REUSEADDR is to make writing (and
  // running) test cases more convenient, so that multiple test runs
  // in close succession don't fail because of a bin() error.
  // Investigate whether there are any potential drawbacks in this,
  // and also whether there's a better way to write the tests.  --
  // CSR, 2007-10-03
  soap.bind_flags |= SO_REUSEADDR;
  m = soap_bind(&soap, NULL, port, 100);
  if (m < 0)
    soap_print_fault(&soap, stderr);
  else
    {
      fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
      /* FIXME: we used to have a global cache of a single LSH index
       * here.  CSR removed it because it interacted badly with
       * APIification of querying, replacing it with a per-open-adb
       * cache; we should try to take advantage of that instead.
       */

      // Server-side path prefix to databases and features
      if(adb_root)
	SERVER_ADB_ROOT = (char*)adb_root; // Server-side database root
      if(adb_feature_root)
	SERVER_ADB_FEATURE_ROOT = (char*)adb_feature_root; // Server-side features root
      
      isServer = 1;  // From this point, errors are reported via SOAP to the client
      for (int i = 1; ; i++)
	{
	  s = soap_accept(&soap);
	  if (s < 0)
	    {
	      soap_print_fault(&soap, stderr);
	      break;
	    }
          /* FIXME: find a way to play nice with logging when run from
             /etc/init.d scripts: at present this just goes nowhere */
	  fprintf(stderr, "%d: accepted connection from IP=%lu.%lu.%lu.%lu 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:bregmanstudio,项目名称:AVA,代码行数:52,代码来源:soap.cpp


示例16: main

int main(int argc, char **argv)
{ struct soap soap;
  struct ns__varPolyParamTestResponse r;
  int n;
  xsd__anyType *p[N];	// array of polymorphic parameters
  soap_init(&soap);
  if (argc < 2)
  { soap_serve(&soap);
    soap_destroy(&soap);
    soap_end(&soap);
    return 0;
  }
  if (argc < 3)
  { p[0] = new xsd__anyURI((char*)endpoint);
    p[1] = new xsd__string(argv[1]);
    p[2] = new xsd__boolean(true);
    p[3] = new xsd__dateTime(time(NULL));
    p[4] = new xsd__double(1234567.89);
    p[5] = new xsd__base64Binary((char*)"encoded in base64");
    p[6] = new xsd__hexBinary((char*)"encoded in hex");
    p[7] = new array(4);
    (*p[7])[0] = new xsd__int(7);
    (*p[7])[1] = NULL;
    (*p[7])[2] = new xsd__token((char*)"x");
    (*p[7])[3] = p[1];
    p[8] = p[1];
    n = 9; // actual number of parameters
    if (soap_call_ns__varPolyParamTest(&soap, endpoint, "", n, p, r))
      soap_print_fault(&soap, stderr);
    else
    { std::cout << "Server has echoed:" << std::endl;
      for (int i = 0; i < r.__size; i++)
        r.param[i]->print(std::cout);
      std::cout << std::endl;
    }
    for (int i = 0; i < n; i++)
      delete p[i];
  }
  else
  { if (soap_call_ns__varStringParamTest(&soap, endpoint, "", argc, argv, n))
      soap_print_fault(&soap, stderr);
    else
      printf("Server has responded to %d strings\n", n);
  }
  soap_destroy(&soap);
  soap_end(&soap);
  soap_done(&soap);
  return 0;
}
开发者ID:119-org,项目名称:TND,代码行数:49,代码来源:varparam.cpp


示例17: main

int main()
{ struct soap soap;
  soap_init2(&soap, SOAP_IO_KEEPALIVE, SOAP_IO_KEEPALIVE | SOAP_XML_INDENT);
  /* Events A to C do not generate a response from the server */
  fprintf(stderr, "Client Sends Event: A\n");
  if (soap_send_ns__handle(&soap, event_handler_endpoint, event_handler_action, EVENT_A))
    soap_print_fault(&soap, stderr);
  if (synchronous && soap_recv_empty_response(&soap))
    soap_print_fault(&soap, stderr);
  fprintf(stderr, "Client Sends Event: B\n");
  if (soap_send_ns__handle(&soap, event_handler_endpoint, event_handler_action, EVENT_B))
    soap_print_fault(&soap, stderr);
  if (synchronous && soap_recv_empty_response(&soap))
    soap_print_fault(&soap, stderr);
  /* reset keep-alive when client needs to inform the server that it will close the connection. It may reconnect later */
  soap_clr_omode(&soap, SOAP_IO_KEEPALIVE);
  fprintf(stderr, "Client Sends Event: C\n");
  if (soap_send_ns__handle(&soap, event_handler_endpoint, event_handler_action, EVENT_C))
    soap_print_fault(&soap, stderr);
  if (synchronous && soap_recv_empty_response(&soap))
    soap_print_fault(&soap, stderr);
  /* close the socket */
  soap_closesock(&soap);
  /* re-enable keep-alive which is required to accept and execute multiple receives */
  soap_set_omode(&soap, SOAP_IO_KEEPALIVE);
  /* Events Z generates a series of response from the server */
  fprintf(stderr, "Client Sends Event: Z\n");
  if (soap_send_ns__handle(&soap, event_handler_endpoint, event_handler_action, EVENT_Z))
    soap_print_fault(&soap, stderr);
  else
  { struct ns__handle response;
    for (;;)
    { if (!soap_valid_socket(soap.socket))
      { fprintf(stderr, "Connection was terminated (keep alive disabled?)\n");
        break;
      }
      if (soap_recv_ns__handle(&soap, &response))
      { if (soap.error == SOAP_EOF)
          fprintf(stderr, "Connection was gracefully closed by server\n");
        else
	  soap_print_fault(&soap, stderr);
	break;
      }
      else
      { switch (response.event)
        { case EVENT_A: fprintf(stderr, "Client Received Event: A\n"); break;
          case EVENT_B: fprintf(stderr, "Client Received Event: B\n"); break;
          case EVENT_C: fprintf(stderr, "Client Received Event: C\n"); break;
          case EVENT_Z: fprintf(stderr, "Client Received Event: Z\n"); break;
        }
      }
    }
  }
  soap_closesock(&soap); /* soap_send operations keep the socket open to possibly accept responses, so we need to explicitly close the socket now */
  soap_end(&soap); /* this will close the socket too (if keep alive is off), just in case */
  soap_done(&soap); /* detach environment (also closes sockets even with keep-alive) */
  return 0;
}
开发者ID:119-org,项目名称:TND,代码行数:58,代码来源:event.c


示例18: main

int main(int argc, char **argv)
{ int m, s;
  struct soap soap;
  soap_init(&soap);
  // cookie domain for CGI must be the current host name:
  // soap.cookie_domain = "www.cs.fsu.edu";
  // Cookie domain for stand-alone server:
  soap.cookie_domain = "localhost:8080";
  // the path which is used to filter/set cookies with this destination
  soap.cookie_path = "/";
  if (argc < 2)
  { // CGI app: grab cookies from 'HTTP_COOKIE' env var
    soap_getenv_cookies(&soap);
    soap_serve(&soap);
  }
  else
  { int port;
    char buf[100];
    port = atoi(argv[1]);
    m = soap_bind(&soap, NULL, port, 100);
    if (m < 0)
    { soap_print_fault(&soap, stderr);
      exit(1);
    }
    sprintf(buf, "localhost:%d", port);
    soap.cookie_domain = buf;
    fprintf(stderr, "Socket connection successful %d\n", m);
    for (int i = 1; ; i++)
    { s = soap_accept(&soap);
      if (s < 0)
        exit(-1);
      fprintf(stderr, "%d: accepted %d IP=%d.%d.%d.%d ... ", i, s, (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
      if (!soap_serve(&soap))
        fprintf(stderr, "served\n");
      else
        soap_print_fault(&soap, stderr);
      // clean up 
      soap_destroy(&soap);
      soap_end(&soap);
      // remove all old cookies from database so no interference when new
      // requests with new cookies arrive
      soap_free_cookies(&soap);
      // Note: threads can have their own cookie DB which they need to cleanup
      // before they terminate
    }
  }
  return 0;
}
开发者ID:allenway,项目名称:onvif,代码行数:48,代码来源:ckserver.cpp


示例19: probeUnicast

//采用单播形式发送probe,发送会马上阻塞等待一个事件响应,事件参考event.c
//只能接收一个event,用于指定地址probe,比如手动添加IPC
static int probeUnicast(const char *endpoint, const char * types, const char *scopes,int timeout)
{
	struct soap *soap = soap_new1(SOAP_IO_UDP); // to invoke messages
	int ret;
	const char *id = soap_wsa_rand_uuid(soap);
	//设置超时时间,>0单位为秒 =0 用不超时 <0单位为微秒
	soap->accept_timeout = soap->recv_timeout = soap->send_timeout = timeout;
	ret = soap_wsdd_Probe(soap,
			  SOAP_WSDD_MANAGED,//SOAP_WSDD_ADHOC,	// ad-hoc mode
			  SOAP_WSDD_TO_TS,	// to a TS
			  endpoint, // address of TS; "soap.udp://239.255.255.250:3702"
			  id,	// message ID
			  NULL, // ReplyTo,表示回应的message ID,因为是主动回发起,所以没有,填NULL
			  types, //types,搜寻的设备类型"dn:NetworkVideoTransmitter tds:Device"
			  scopes,    //scopes,指定搜索范围,无填 NULL
			  NULL);   //match by,匹配规则,无填 NULL
	if(ret!=SOAP_OK)
	{
		soap_print_fault(soap, stderr);
		printf("soap_wsdd_Probe error,ret=%d\n",ret);
	}
	soap_end(soap);
	soap_free(soap);
	return ret;
}
开发者ID:allenway,项目名称:onvif,代码行数:27,代码来源:main.c


示例20: ProcessRequest

static void ProcessRequest(void *soap)
{
    int32_t Ret;
    struct soap *tsoap = (struct soap*)soap;

    //pthread_detach(pthread_self()); //guoqiang.lu mask,11/20/2013

    l_ThreadCnt++;

    Ret = soap_serve(tsoap);
    if (SOAP_OK != Ret
            && (tsoap->error != SOAP_EOF
                || (tsoap->errnum != 0 && !(tsoap->omode & SOAP_IO_KEEPALIVE))))
    {
        fprintf(stderr, "Thread %d completed with failure %d, Ret %d\n", \
                (int)(SOAP_SOCKET)tsoap->user, tsoap->error, Ret);
        DEBUG_LOG(g_DefaultLogClient, e_DebugLogLevel_Exception, "Thread %d completed with failure %d\n", (int)(SOAP_SOCKET)tsoap->user, tsoap->error);
        soap_print_fault(tsoap, stderr);
    }

    soap_destroy(tsoap);
    soap_end(tsoap);
    soap_done(tsoap);
    soap_free(tsoap);
    close((SOAP_SOCKET)tsoap->user);

    l_ThreadCnt--;

    ONVIF_INFO("======>%s %d exit, Total ThreadCnt %d\n", __func__, __LINE__, l_ThreadCnt);    
    //mask by guoqiang.lu,2014/1/8
    //pthread_exit(NULL);
}
开发者ID:JammyWei,项目名称:ver30,代码行数:32,代码来源:web_server.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ soap_putheader函数代码示例发布时间:2022-05-30
下一篇:
C++ soap_new函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap