本文整理汇总了C++中soap_print_fault函数的典型用法代码示例。如果您正苦于以下问题:C++ soap_print_fault函数的具体用法?C++ soap_print_fault怎么用?C++ soap_print_fault使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了soap_print_fault函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
示例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;
}
示例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
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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
}