00001 //--------------------------------------------------- 00002 // msd_soap_saclient.cc 00003 // 00004 // Project: PDBe API Framework 00005 // Module: C++ Client example PDBe API Webservice (SOAP) Server 00006 // 00007 // To build: 00008 // make wsaclient 00009 // 00010 // SOAP User Layer 00011 // Last updated: 25 February 2004 10:17 00012 // (C) Siamak Sobhany 00013 //--------------------------------------------------- 00014 // 00015 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00016 // To run msd api web services as a multi-threaded stand-alone server: 00017 // ./msd_soap_service parrot.ebi.ac.uk 8100 00018 // 00019 // Then run this client: 00020 // /ebi/msd/work/siamak/apache/cgi-bin/msd_soap_saclient 00021 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00022 00023 #include "msd_soapH.h" 00024 #include "msd_soap_service.nsmap" 00025 #include "Lpp.hh" 00026 00027 #include <iostream> 00028 #include <string.h> 00029 using namespace std; 00031 // 00032 // PDBe Data Warehouse client for msd API Web Services 00033 // 00035 // To access a stand-alone server on a port: msd_soap_service[] = "IP:PORT"; 00036 // use "http://" to include HTTP header: msd_soap_service[] = "http://IP:PORT"; 00037 // const char msd_soap_service[] = "parrot.ebi.ac.uk:8099" 00038 // const char msd_soap_service[] = "http://parrot.ebi.ac.uk:8099"; 00039 00040 00041 00042 //const char msd_soap_service[] = "http://phoenix.ebi.ac.uk:8099/cgi-bin/msd_soap_service.cgi"; 00043 //const char msd_soap_service[] = "http://parrot.ebi.ac.uk:8444"; // .cgi?6758 00044 //const char msd_soap_service[] = "http://www.ebi.ac.uk/msd-srv/msdsoap"; 00045 const char msd_soap_service[] = "http://www.ebi.ac.uk/msd-srv/msdsoapd"; 00046 //const char msd_soap_service[] = "http://web6-node2.ebi.ac.uk:8444"; 00047 //const char msd_soap_service[] = "http://web6-node1.ebi.ac.uk:8555"; 00048 const char endpoint[] = "http://websrv.cs.fsu.edu/~engelen/varparam.cgi"; 00049 #define N 1000 00050 #define M 8 00051 00052 // Client side root methodes: 00053 00054 00055 //t__root*& t__root::operator[](int i) 00056 //{ static t__root *p = this; // trick: we don't expect the operator to be applied, but we need a method 00057 // return p; 00058 //} 00059 00061 #ifndef SO_NOSIGPIPE 00062 // Not present in 10.1.x kernel/headers 00063 #define SO_NOSIGPIPE 0x1022 00064 #endif 00065 static void *dime_write_open(struct soap *soap, const char *id, const char *type, const char *options) 00066 { FILE *handle = NULL; 00067 // we can return NULL without setting soap->error if we don't want to use the streaming callback for this DIME attachment 00068 handle = fopen((char*)soap->user, "wb"); 00069 if (handle) 00070 printf("Streaming image id=%s type=%s into file %s\n", id, type, (char*)soap->user); 00071 else 00072 { soap->error = SOAP_EOF; // could not open file for writing 00073 soap->errnum = errno; // get reason 00074 } 00075 return (void*)handle; 00076 } 00077 00078 static void dime_write_close(struct soap *soap, void *handle) 00079 { fclose((FILE*)handle); 00080 } 00081 00082 static int dime_write(struct soap *soap, void *handle, const char *buf, size_t len) 00083 { size_t nwritten; 00084 while (len) 00085 { nwritten = fwrite(buf, 1, len, (FILE*)handle); 00086 if (!nwritten) 00087 { soap->errnum = errno; // get reason 00088 return SOAP_EOF; 00089 } 00090 len -= nwritten; 00091 buf += nwritten; 00092 } 00093 return SOAP_OK; 00094 } 00095 00096 00097 int main(int argc, char **argv) 00098 { 00099 00100 struct soap soap; 00101 xsd__base64Binary bindata; 00102 char *name; 00103 const char *url; 00104 //soap=soap_new(); 00105 soap_init(&soap); 00106 //soap_set_omode(&soap, SOAP_XML_GRAPH); 00107 soap.userid="geoff"; 00108 soap.passwd="cc12345678"; 00109 00111 //soap.proxy_port = 8080; 00112 //soap_init2(&soap, SOAP_IO_KEEPALIVE, SOAP_IO_KEEPALIVE); 00113 //soap.socket_flags = MSG_NOSIGNAL; 00114 //soap.accept_timeout = 300; 00115 //soap.send_timeout = 60; 00116 //soap.recv_timeout = 60; 00117 //soap_set_omode(&soap, SOAP_ENC_ZLIB); 00118 struct a__Map mi,mi2, mo; 00119 struct ArrayOfMap Ami, Amo; 00120 mi.__size = 3; 00121 mi.__ptr = (struct _item*)soap_malloc(&soap,mi.__size*sizeof(struct _item)); 00122 mi.__ptr[0].key = new xsd__string("Hello"); 00123 mi.__ptr[0].value = new xsd__string("world"); 00124 mi.__ptr[1].key = new xsd__int(2); 00125 mi.__ptr[1].value = new xsd__boolean(true); 00126 mi.__ptr[2].key = new xsd__double(788.005670); 00127 mi.__ptr[2].value = new xsd__string("all right!"); 00128 00129 mi2.__size = 2; 00130 mi2.__ptr = (struct _item*)soap_malloc(&soap,mi2.__size*sizeof(struct _item)); 00131 mi2.__ptr[0].key = new xsd__string("How are you"); 00132 mi2.__ptr[0].value = new xsd__string("Universe"); 00133 //mi.__ptr[1].key = new xsd__int(2); 00134 //mi.__ptr[1].value = new xsd__boolean(true); 00135 mi2.__ptr[1].key = new xsd__float(123.004567); 00136 mi2.__ptr[1].value = new xsd__int(78654); 00137 00138 Ami.__size = 2; 00139 Ami.__ptr = (struct a__Map**)soap_malloc(&soap,Ami.__size*sizeof(struct a__Map*)); 00140 Ami.__ptr[0] = &mi; 00141 Ami.__ptr[1] = &mi2; 00142 00143 //soap.connect_flags = SO_NOSIGPIPE; 00144 //####struct ns4__varPolyParamTestResponse r; 00145 //struct t__queryResp rs; 00146 //ns4__msdExecQueryResponse rs; 00147 array rs1; 00148 //array rs2; 00149 ns4__msdGetResultResponse rs2; 00150 int n; 00151 xsd__anyType *p[M]; 00152 xsd__anyType *pp[N]; 00153 char* tmp; 00154 tmp=(char*)soap_malloc(&soap, strlen(msd_soap_service)+1); 00155 strcpy(tmp,msd_soap_service); 00156 p[0] = new xsd__anyURI(tmp); 00157 tmp=(char*)soap_malloc(&soap, strlen(endpoint)+1); 00158 strcpy(tmp,endpoint); 00159 p[1] = new xsd__string(tmp); 00160 p[2] = new xsd__boolean(false); 00161 p[3] = new xsd__dateTime(1234567); 00162 p[4] = new xsd__double(1234567.89); 00163 p[5] = new xsd__base64Binary("encoded in base64"); 00164 p[6] = new xsd__hexBinary("encoded in hex"); 00165 p[7] = new array(3); 00166 (*p[7])[0] = new xsd__int(7); 00167 (*p[7])[1] = new xsd__token("x"); 00168 (*p[7])[2] = new xsd__float(1234.8765); 00169 //soap->keep_alive = 1; 00171 char* tmp1; 00172 char* tmp2; 00173 tmp1=(char*)soap_malloc(&soap, strlen(msd_soap_service)+1); 00174 strcpy(tmp1,msd_soap_service); 00175 00176 tmp2=(char*)soap_malloc(&soap, strlen("http://phoenix.ebi.ac.uk:8099/cgi-bin/msd_soap_service.cgi")+1); 00177 strcpy(tmp2,"http://phoenix.ebi.ac.uk:8099/cgi-bin/msd_soap_service.cgi"); 00178 for (int n=0;n<N ;++n ){ 00179 pp[n]= new array(12); 00180 (*pp[n])[0] = new xsd__float(1234.8765); 00181 (*pp[n])[1] = new xsd__int(7); 00182 (*pp[n])[2]= new xsd__string(tmp1); 00183 (*pp[n])[3]= new xsd__float(1234.8765); 00184 (*pp[n])[4]= new xsd__int(80); 00185 (*pp[n])[5]= new xsd__string(tmp2); 00186 (*pp[n])[6]= new xsd__float(99234.8765); 00187 (*pp[n])[7]= new xsd__int(66); 00188 (*pp[n])[8]= new xsd__string(tmp1); 00189 (*pp[n])[9]= new xsd__float(1234.8765); 00190 (*pp[n])[10]= new xsd__int(2345); 00191 (*pp[n])[11] = new xsd__string(tmp2); 00192 //for (int m=0;m<12 ;++m ){ 00193 //(*pp[n])[m]->msd_sym=intern( msdConst("FieldNo")); 00194 //} 00195 } 00196 00197 00198 00199 00200 00201 00202 00203 00205 if (! &soap) 00206 { 00207 printf ("\nCan not allocate environment for Web services.\n"); 00208 return (1); 00209 } 00210 //struct soap soap; 00211 //soap_init(&soap); 00212 int result; 00213 t__status stts; 00214 char* logstr= "api2/api255@msdsrchd"; //"search/search55@msdsrch1";//"api/api55@msdsrchd"; 00215 //char* logstr= "api1/api155@msdsrchd"; 00216 char* logs; 00217 logs = (char*)soap_malloc(&soap, strlen(logstr)+1); 00218 strcpy(logs, logstr); 00219 char* sql; 00220 //char* statement="select /*+ INDEX_COMBINE(component component_id) */ * from component where " 00221 // "component_id >= :f<int> and component_id <= 50000*:f<int>"; 00222 00223 //char* statement="select /*+ INDEX_COMBINE(atom_data accession_code) */ * from WHOUSE1.atom_data where " 00224 // "atom_id >= 1 and atom_id <= 200"; // :f<int> 00225 00226 char* statement="select * from WHOUSE1.atom_data where " 00227 "where atom_id >= 2010000 and atom_id <= 2016000 and 1*:f<int>=1"; // :f<int> 00228 00229 sql = (char*)malloc(strlen(statement)+1); 00230 strcpy(sql, statement); 00231 char *argvNew[5]; 00232 int pid; 00233 int nomtabs=35; 00234 printf("Content-type: text/html\r\n\r\n<html><h2>Client for PDBe API Framework Web Services from %s</h2><pre>\n", msd_soap_service); 00235 00236 00237 00238 array * app_params; 00239 app_params = new array(3); 00240 (*app_params)[0]= new xsd__string("/ebi/msd/work/siamak/apache/cgi-bin/msd_main"); 00241 (*app_params)[1]= new xsd__string(" > "); 00242 (*app_params)[2]= new xsd__string("/ebi/msd/work/siamak/apache/htdocs/appserv.txt"); 00243 00244 00245 // Call appserver 00246 //char* app="/ebi/msd/work/siamak/apache/cgi-bin/msd_main > /ebi/msd/work/siamak/apache/htdocs/appserv.txt"; 00247 //cmdexec = (char*)malloc(strlen(app)+1); 00248 //strcpy(cmdexec, app); 00249 00250 00251 00252 //~~~~~ if (soap_call_ns4__msdAppserv(soap, msd_soap_service, "urn:msd_soap_service#msdAppserv", 3, app_params, result)== SOAP_OK) //http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service#msdConninit 00253 //~~~~~ { printf ("\nPDBe Application Server Service initialized...\n"); 00254 //~~~~~ } 00255 //~~~~~ else 00256 //~~~~~ { printf ("\nPDBe Application Server Service failed...(Error %d) \n", result); 00257 //~~~~~ soap_print_fault(soap, stderr); 00258 //~~~~~ soap_print_fault_location(soap, stderr); 00259 //~~~~~ } 00260 //t__status res; 00261 00262 00263 00264 00265 int conn_res = -1; 00266 int conn_resp = -1; 00267 int res_res = -1; 00268 int res_resp = -1; 00269 int qry_res = -1; 00270 int qry_resp = -1; 00271 //"msdsrchd","api1","api155" 00272 if (soap_call_ns4__msdConnect(&soap, msd_soap_service, "urn:msd_soap_service#msdConnect", "MyConnection", conn_res)== SOAP_OK) //http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service#msdConninit 00273 { printf ("\nConnect initialized...%d\n", conn_res); 00274 conn_resp=0; 00275 } 00276 else 00277 { printf ("Connect failed ...(Error) %d \n", conn_res); 00278 conn_resp = 1; 00279 soap_print_fault(&soap, stderr); 00280 soap_print_fault_location(&soap, stderr); 00281 } 00282 00283 if (conn_res == 0 && conn_resp == 0) 00284 {if (soap_call_ns4__msdResultset(&soap, msd_soap_service, "urn:msd_soap_service#msdResultset", "MyConnection","MyQuery","MyResult", res_res)== SOAP_OK) //http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service#msdConninit 00285 { printf ("\nmsdResultset Set initialized...%d\n", res_res); 00286 res_resp=0; 00287 } 00288 else 00289 { printf ("msdResultset failed ...(Error) %d \n", res_res); 00290 res_resp =1; 00291 soap_print_fault(&soap, stderr); 00292 soap_print_fault_location(&soap, stderr); 00293 } 00294 }else 00295 { printf ("\nmsdResultset Set not called.\n"); 00296 } 00297 00298 00299 00300 00302 if (conn_resp == 0 && res_resp == 0) 00303 {if (soap_call_ns4__msdQuery(&soap, msd_soap_service, "urn:msd_soap_service#msdQuery", "MyConnection","MyQuery","MyResult",sql, qry_res)== SOAP_OK) //http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service#msdConninit 00304 { printf ("\nmsdQuery called...%d\n", qry_res); 00305 qry_resp=0; 00306 } 00307 else 00308 { printf ("msdQuery failed ...(Error) %d \n", qry_res); 00309 qry_resp=1; 00310 soap_print_fault(&soap, stderr); 00311 soap_print_fault_location(&soap, stderr); 00312 } 00313 00314 }else 00315 {printf ("\nmsdQuery not called.\n"); 00316 } 00317 00318 00319 //~~~~*****if (soap_call_ns4__varPolyParamTest(&soap, msd_soap_service, "urn:msd_soap_service#varPolyParamTest", N, pp, r)) 00320 //~~~~***** soap_print_fault(&soap, stderr); 00321 //~~~~***** else 00322 //~~~~***** { ofstream outfile; 00323 //~~~~***** outfile.open("exec_queryClient.txt"); 00324 //~~~~***** outfile << "Server has echoed:" << endl; 00325 //~~~~***** for (int i = 0; i < r.__size; i++) 00326 //~~~~***** {outfile << "p[" << i << "] = "; 00327 //~~~~***** pp[i]->print(outfile); 00328 //~~~~***** outfile << endl; 00329 //~~~~***** outfile << "r.param[" << i << "] = "; 00330 //~~~~***** r.param[i]->print(outfile); 00331 //~~~~***** outfile <<endl; 00332 //~~~~***** } 00333 //~~~~***** outfile.close(); 00334 //~~~~***** 00335 //~~~~***** 00336 //~~~~***** 00337 //~~~~***** } 00338 //~~~~***** for (int i = 0; i < N; i++){ 00339 //~~~~***** delete pp[i]; 00340 //~~~~***** } 00341 //~~~~***** { if (soap_call_ns4__varStringParamTest(&soap, msd_soap_service, "urn:msd_soap_service#varStringParamTest", argc, argv, n)) 00342 //~~~~***** soap_print_fault(&soap, stderr); 00343 //~~~~***** else 00344 //~~~~***** printf("Server has responded to %d strings\n", n); 00345 //~~~~***** } 00346 //~~~~***** 00347 00348 00349 00350 int status= -1; 00351 int exec_resp=-1; 00352 //soap.keep_alive=0; 00353 if (conn_resp == 0 && res_resp == 0 && qry_resp == 0){ 00354 soap.userid="geoff"; 00355 soap.passwd="cc12345678"; 00356 if (soap_call_ns4__msdExecQuery(&soap, msd_soap_service, "urn:msd_soap_service#msdExecQuery", "MyConnection","MyQuery","MyResult",50, status)== SOAP_OK) //http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service#msdConninit 00357 { printf ("\nmsdExecQuery initialized...%d\n", status); 00358 exec_resp=0; 00359 } 00360 else 00361 {printf ("msdExecQuery failed ...(Error %d)\n", status); 00362 exec_resp=1; 00363 soap_print_fault(&soap, stderr); 00364 soap_print_fault_location(&soap, stderr);} 00365 }else{printf ("msdExecQuery not called.\n"); 00366 } 00367 00368 int get_resp=-1; 00369 if (exec_resp == 0) 00370 {if (soap_call_ns4__msdGetResult(&soap, msd_soap_service, "urn:msd_soap_service#msdGetResult", "MyConnection","MyQuery","MyResult", rs2)) //http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service#msdConninit 00371 { printf ("GetResult failed ...(Error)\n"); 00372 get_resp=1; 00373 soap_print_fault(&soap, stderr); 00374 soap_print_fault_location(&soap, stderr); 00375 } 00376 else 00377 {printf ("\nGetResult initialized...\n"); 00378 get_resp=0; 00379 //ofstream outfile; 00380 //outfile.open("GetResultClient.txt"); 00381 //outfile << "Server has echoed:" << endl; 00382 for (int i = 0; i < rs2.rs.cols; i++){ //__size 00383 //outfile << "rs.rs.__ptr[" << i << "] = "; 00384 for (int j = 0;j < rs2.rs.rows; j++) 00385 { rs2.rs.prs[i][j].print(std::cout); //__ptr[i] 00386 00387 } 00388 //rs.__ptr[i]->fprint(outfile); 00389 00390 //outfile <<endl; 00391 } 00392 //outfile.close(); 00393 } 00394 }else{printf ("msdGetResult not called.\n"); 00395 } 00396 00397 int ou = -1; 00398 if (get_resp == 0) 00399 {if (soap_call_ns4__msdEndQueryPack(&soap, msd_soap_service, "urn:msd_soap_service#msdEndQueryPack", "MyQuery","MyResult", ou) == SOAP_OK) //http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service#msdConninit 00400 { printf ("\nEndSession initialized...%d\n", ou); 00401 00402 } 00403 else 00404 { printf ("msdEndQueryPack failed ...(Error %d)\n", ou); 00405 soap_print_fault(&soap, stderr); 00406 soap_print_fault_location(&soap, stderr); 00407 } 00408 00409 00410 } 00411 00412 00413 00414 //~~~~~~~if ((soap_call_ns4__msdExecQuery2(&soap, msd_soap_service, "urn:msd_soap_service#msdExecQuery2", "MyConnection","MyQuery","MyResult",50,sql,rs)) && qry_res != 0) //http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service#msdConninit 00415 //~~~~~~~ { printf ("Query failed ...(Error)\n"); 00416 //~~~~~~~ status = 1; 00417 //~~~~~~~ soap_print_fault(&soap, stderr); 00418 //~~~~~~~ soap_print_fault_location(&soap, stderr); 00419 //~~~~~~~ } 00420 //~~~~~~~ else 00421 //~~~~~~~ {printf ("\nQuery initialized...\n"); 00422 //~~~~~~~ status = 0; 00423 //~~~~~~~ ofstream outfile; 00424 //~~~~~~~ outfile.open("exec_queryClient2.txt"); 00425 //~~~~~~~ outfile << "Server has echoed:" << endl; 00426 //~~~~~~~ for (int i = 0; i < rs.__size; i++){ 00427 //~~~~~~~ outfile << "rs.rs.__ptr[" << i << "] = "; 00428 //~~~~~~~ rs.__ptr[i]->fprint(outfile); 00429 //~~~~~~~ rs.__ptr[i]->print(std::cout); 00430 //~~~~~~~ outfile <<endl; 00431 //~~~~~~~ } 00432 //~~~~~~~ outfile.close(); 00433 //~~~~~~~} 00434 00435 00436 00437 00438 00439 00440 //t__object obj; 00441 //~~ t__status status; 00442 //~~ 00443 //~~ if (soap_call_ns4__create(soap, msd_soap_service, "urn:msd_soap_service#create", OTLCONNECT , "MyConnection", status)== SOAP_OK) //http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service#msdConninit 00444 //~~ { printf ("\nCreated...%d\n", status); 00445 //~~ } 00446 //~~ else 00447 //~~ { printf ("Create failed ...(Error)%d \n", status); 00448 //~~ soap_print_fault(soap, stderr); 00449 //~~ soap_print_fault_location(soap, stderr); 00450 //~~ } 00451 //~~if (soap_call_ns4__lookup(soap, msd_soap_service, "urn:msd_soap_service#lookup", OTLCONNECT , "MyConnection", status)== SOAP_OK) //http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service#msdConninit 00452 //~~ { printf ("\nlookup successed...%d\n", status); 00453 //~~ } 00454 //~~ else 00455 //~~ { printf ("lookup failed ...(Error) %d \n", status); 00456 //~~ soap_print_fault(soap, stderr); 00457 //~~ soap_print_fault_location(soap, stderr); 00458 //~~ } 00459 00460 00461 //~~~~~~~~ if(soap_call_ns4__msdGetTables_relations(soap, msd_soap_service, "urn:msd_soap_service#msdGetTablesRelations",logs,result)== SOAP_OK) 00462 //~~~~~~~~ { printf ("\nSuccessfull Getting Relations...\n"); 00463 //~~~~~~~~ } 00464 //~~~~~~~~ else 00465 //~~~~~~~~ { printf ("Getting relations failed...(Error %d) \n", result); 00466 //~~~~~~~~ soap_print_fault(soap, stderr); 00467 //~~~~~~~~ soap_print_fault_location(soap, stderr); 00468 //~~~~~~~~ } 00469 //~~~~~~~~ if(soap_call_ns4__msdGetDatamodel(soap, msd_soap_service, "urn:msd_soap_service#msdGetDatamodel", logs,result)== SOAP_OK) 00470 //~~~~~~~~ { printf ("\nSuccessfull Getting Data Model...\n"); 00471 //~~~~~~~~ } 00472 //~~~~~~~~ else 00473 //~~~~~~~~ { printf ("Getting Data Model failed...(Error %d) \n", result); 00474 //~~~~~~~~ soap_print_fault(soap, stderr); 00475 //~~~~~~~~ soap_print_fault_location(soap, stderr); 00476 //~~~~~~~~ } 00477 //~~~~~~~~ 00478 //~~~~~~~~ //if(soap_call_ns4__msdLispEval(soap, msd_soap_service, "urn:msd_soap_service#msdLispEval",result)== SOAP_OK) 00479 //~~~~~~~~ //{ printf ("\nSuccessfull System Call...\n"); 00480 //~~~~~~~~ // } 00481 //~~~~~~~~ //else 00482 //~~~~~~~~ //{ printf ("System call failed...(Error %d) \n", result); 00483 //~~~~~~~~ // soap_print_fault(soap, stderr); 00484 //~~~~~~~~ // soap_print_fault_location(soap, stderr); 00485 //~~~~~~~~ //} 00486 //~~~~~~~~ ///////////////////////////////////////////////// 00487 00488 //~~####### soap.user = (void*)argv[1]; // soap.user is always available for user data 00489 //~~####### soap.fdimewriteopen = dime_write_open; 00490 //~~####### soap.fdimewriteclose = dime_write_close; 00491 //~~####### soap.fdimewrite = dime_write; 00492 //~~####### name = argv[1]; // this is the name of the image 00493 //~~####### // second argument is optional endpoint URL 00494 //~~####### soap.connect_timeout = 10; 00495 //~~####### if (soap_call_ns4__msdGetDime(&soap, msd_soap_service, "urn:msd_soap_service#msdGetDime", 1, name, bindata)) 00496 //~~####### soap_print_fault(&soap, stderr); 00497 //~~####### else 00498 //~~####### printf("Got file type=%s through streaming DIME\n", bindata.type?bindata.type:""); // image.__ptr = file handle and image.__size == 0 when streaming was used 00499 //~~####### 00500 //~~####### 00501 //~~####### 00502 //~~####### 00503 //~~####### 00504 //~~####### 00505 //~~####### int i, j, g; 00506 //~~####### ofstream outfile; 00507 //~~####### outfile.open("Map.txt", ofstream::out | ofstream::app); 00508 //~~####### if (soap_call_ns4__echoMap(&soap, msd_soap_service, "urn:msd_soap_service#echoMap", mi, mo)) 00509 //~~####### { printf("echoMap FAULT..."); 00510 //~~####### 00511 //~~####### soap_print_fault(&soap, stderr); 00512 //~~####### soap_print_fault_location(&soap, stderr); 00513 //~~####### 00514 //~~####### } 00515 //~~####### else 00516 //~~####### { g = 0; 00517 //~~####### if (mi.__size != mo.__size || !mo.__ptr) 00518 //~~####### g = 1; 00519 //~~####### else 00520 //~~####### { 00521 //~~####### 00522 //~~####### for (i = 0; i < mi.__size; i++){ 00523 //~~####### outfile << "mi.__ptr[" << i << "] = "; 00524 //~~####### mi.__ptr[i].key->print(outfile); 00525 //~~####### outfile <<" , "; 00526 //~~####### mi.__ptr[i].value->print(outfile); 00527 //~~####### outfile <<endl; 00528 //~~####### //printf( "%s" , mi.__ptr[i].key->__item); // need to check values here! 00529 //~~####### //printf( "%s" , mi.__ptr[i].value->__item); 00530 //~~####### } 00531 //~~####### 00532 //~~####### } 00533 //~~####### if (g==1) 00534 //~~####### { printf("Maps differ..."); 00535 //~~####### } 00536 //~~####### else{ 00537 //~~####### 00538 //~~####### 00539 //~~####### for (i = 0; i < mo.__size; i++){ // need to check values here! 00540 //~~####### outfile << "mo.__ptr[" << i << "] = "; 00541 //~~####### mo.__ptr[i].key->print(outfile); 00542 //~~####### outfile <<" , "; 00543 //~~####### mo.__ptr[i].value->print(outfile); 00544 //~~####### outfile <<endl; 00545 //~~####### } 00546 //~~####### 00547 //~~####### printf("PASS\n"); 00548 //~~####### } 00549 //~~####### } 00550 //~~####### 00551 //~~####### if (soap_call_ns4__echoMapArray(&soap, msd_soap_service, "urn:msd_soap_service#echoMapArray", Ami, Amo)) 00552 //~~####### { printf("echoMapArray FAULT..."); 00553 //~~####### 00554 //~~####### soap_print_fault(&soap, stderr); 00555 //~~####### soap_print_fault_location(&soap, stderr); 00556 //~~####### 00557 //~~####### } 00558 //~~####### else 00559 //~~####### { g = 0; 00560 //~~####### if (Ami.__size != Amo.__size || !Amo.__ptr) 00561 //~~####### g = 1; 00562 //~~####### else 00563 //~~####### { for (i = 0; i < Ami.__size; i++){ 00564 //~~####### outfile << "Ami.__ptr[" << i << "] = "; // need to check values here 00565 //~~####### for (j = 0; j < Ami.__ptr[i]->__size; j++){ 00566 //~~####### Ami.__ptr[i]->__ptr[j].key->print(outfile); 00567 //~~####### outfile <<" , "; 00568 //~~####### Ami.__ptr[i]->__ptr[j].value->print(outfile); 00569 //~~####### outfile <<endl; 00570 //~~####### } 00571 //~~####### } 00572 //~~####### } 00573 //~~####### if (g) 00574 //~~####### {printf("Map Arrays differ..."); 00575 //~~####### } 00576 //~~####### else{ 00577 //~~####### printf("PASS\n"); 00578 //~~####### } 00579 //~~####### } 00580 //~~####### outfile.close(); 00581 //~~####### 00582 //~~####### 00583 //~~####### 00584 00585 00586 00587 00588 printf("</pre></html>\n"); 00589 //soap_dealloc(&soap,NULL); 00590 //soap_destroy(&soap); 00591 soap_end(&soap); 00592 soap_free(&soap); 00593 soap_done(&soap); 00594 return 0; 00595 } 00597 00599 // 00600 // Namespace Definition Table 00601 // 00603 00605 //struct Namespace namespaces[] = 00606 //{ // {"ns-prefix", "ns-name" [, "ns-pattern"]} 00607 // {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"}, 00608 // {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"}, 00609 // {"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance"}, 00610 // {"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema"}, 00611 // {"t", "urn:msd_soap_types"}, 00612 // {"h", "urn:msd_soap_handles"}, 00613 // {"ns", "urn:msd_soap_service"}, 00614 // {NULL, NULL} 00615 //}; 00617
1.3.4-20031005