00001 #include "msd_soapH.h"
00002 #include "msd_soap_service.nsmap"
00003 #include <iostream>
00004 #include <string.h>
00005 using namespace std;
00007
00008
00009
00011
00012
00013
00014
00015
00016
00017
00018
00019 const char msd_soap_service[] = "http://parrot.ebi.ac.uk:8099/cgi-bin/msd_soap_service.cgi";
00020 const char endpoint[] = "http://websrv.cs.fsu.edu/~engelen/varparam.cgi";
00021 #define N 8
00022
00023
00024
00025 int main(int argc, char **argv)
00026 {
00027
00028 struct soap *soap;
00029 soap= soap_new();
00030 struct ns__varPolyParamTestResponse r;
00031 int n;
00032 xsd__anyType *p[N];
00033 char* tmp;
00034 tmp=(char*)soap_malloc(soap, strlen(msd_soap_service)+1);
00035 strcpy(tmp,msd_soap_service);
00036 p[0] = new xsd__anyURI(tmp);
00037 tmp=(char*)soap_malloc(soap, strlen(endpoint)+1);
00038 strcpy(tmp,endpoint);
00039 p[1] = new xsd__string(tmp);
00040 p[2] = new xsd__boolean(false);
00041 p[3] = new xsd__dateTime(1234567);
00042 p[4] = new xsd__double(1234567.89);
00043 p[5] = new xsd__base64Binary("encoded in base64");
00044 p[6] = new xsd__hexBinary("encoded in hex");
00045 p[7] = new array(3);
00046 (*p[7])[0] = new xsd__int(7);
00047 (*p[7])[1] = new xsd__token("x");
00048 (*p[7])[2] = new xsd__float(1234.8765);
00049
00050 if (! soap)
00051 {
00052 printf ("\nCan not allocate environment for Web services.\n");
00053 return (1);
00054 }
00055
00056
00057 int result;
00058
00059 char* logstr="whouse/whouse@msdtrnsd";
00060 char* logs;
00061 logs = (char*)soap_malloc(soap, strlen(logstr)+1);
00062 strcpy(logs, logstr);
00063 char* sql;
00064
00065
00066
00067 char* statement="select /*+ INDEX_COMBINE(component component_id) */ * from component where "
00068 "component_id >= 1 and component_id <= 200";
00069 sql = (char*)malloc(strlen(statement)+1);
00070 strcpy(sql, statement);
00071 char *argvNew[5];
00072 int pid;
00073 int nomtabs=35;
00074 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);
00075
00076 char* xmlfn;
00077 char* xmlfile="/homes/sobhany/apache/htdocs/output.xml";
00078 xmlfn = (char*)soap_malloc(soap, strlen(xmlfile)+1);
00079 strcpy(xmlfn, xmlfile);
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00102
00103
00104
00105
00106
00107
00108 array * par;
00109 par = new array(3);
00110 char* temp="<SSMInput>"
00111 "<query>"
00112 "<type>PDB entry</type> "
00113 "<pdbcode>1sar</pdbcode> "
00114 "</query> "
00115 "<target> "
00116 "<type>PDB archive</type> "
00117 "</target>\n "
00118 "<selection> "
00119 "<type>\n Chain(s)</type>\n"
00120 " <chains>*(all)</chains>\n"
00121 " </selection>"
00122 "<percent1>70</percent1> \n \n"
00123 "<percent2>70</percent2>"
00124 "<sepchains> Yes </sepchains>"
00125 "<connectivity> Yes </connectivity> "
00126 "<bestmatch>\n Yes</bestmatch>"
00127 "<uniquematch>Yes</uniquematch>"
00128 "<precision>Normal</precision>"
00129 "<sorting>RMSD</sorting>\n \n"
00130 "</SSMInput> ";
00131 char* buffers;
00132 buffers = (char*)soap_malloc(soap, strlen(temp)+1);
00133 strcpy(buffers,temp);
00134 (*par)[0]= new xsd__string(buffers);
00135 (*par)[1]= new xsd__string("AAAA");
00136 (*par)[2]= new xsd__string("BBBB");
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162 char* cmdexec;
00163 char* cmd="/ebi/msd/ssm/cgi-bin/ssm -offline /homes/sobhany/apache/htdocs/input.xml /homes/sobhany/apache/htdocs/output.xml /ebi/msd/ssm/ssmdata/ssmsrv.conf_parrot > /homes/sobhany/apache/htdocs/ssmws.log";
00164
00165
00166 char* session="AAAA";
00167 cmdexec = (char*)malloc(strlen(cmd)+1);
00168 strcpy(cmdexec, cmd);
00169
00170 if (soap_call_ns__msd_ssm(soap, msd_soap_service, "urn:msd_soap_service#msd-ssm",3, par, result)== SOAP_OK)
00171 { printf ("\nPDBe SSM Web Service initialized...\n");
00172 }
00173 else
00174 { printf ("\nPDBe SSM Web Service failed...(Error %d) \n", result);
00175 soap_print_fault(soap, stderr);
00176 soap_print_fault_location(soap, stderr);
00177 }
00178
00179
00181 array * fasta_params;
00182 fasta_params = new array(2);
00183
00184
00185
00186
00187
00188 (*fasta_params)[0]= new xsd__string("MMM000");
00189
00190 char* instr ="<fatsa> "
00191 " <sequence> VMVSPMASIRSDEGMPIFVGDRSNVQDGVVLHALETINEEGEPIEDNI \n</sequence>"
00192 " <evalue> 1e-10 </evalue>\n"
00193 " \n<library> PDB </library> "
00194 " </fatsa> \n";
00195 char* buffers;
00196 buffers = (char*)soap_malloc(soap, strlen(instr)+1);
00197 strcpy(buffers,instr);
00198 (*fasta_params)[1]= new xsd__string(buffers);
00199
00200
00201
00202
00203 if (soap_call_ns__msd_fasta(soap, msd_soap_service, "urn:msd_soap_service#msd-fasta", 4, fasta_params, result)== SOAP_OK)
00204 { printf ("\nPDBe FASTA Server Service initialized...\n");
00205 }
00206 else
00207 { printf ("\nPDBe FASTA Server Service failed...(Error %d) \n", result);
00208 soap_print_fault(soap, stderr);
00209 soap_print_fault_location(soap, stderr);
00210 }
00212
00213
00214
00215 array * app_params;
00216 app_params = new array(3);
00217 (*app_params)[0]= new xsd__string("/tmp_mnt/net_nfs6/vol1/homes/sobhany/apache/cgi-bin/msd_main");
00218 (*app_params)[1]= new xsd__string(" > ");
00219 (*app_params)[2]= new xsd__string("/homes/sobhany/apache/htdocs/appserv.txt");
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229 if (soap_call_ns__msd_appserv(soap, msd_soap_service, "urn:msd_soap_service#msd-appserv", 3, app_params, result)== SOAP_OK)
00230 { printf ("\nPDBe Application Server Service initialized...\n");
00231 }
00232 else
00233 { printf ("\nPDBe Application Server Service failed...(Error %d) \n", result);
00234 soap_print_fault(soap, stderr);
00235 soap_print_fault_location(soap, stderr);
00236 }
00237
00238 if (soap_call_ns__msd_srv_pxml(soap, msd_soap_service, "urn:msd_soap_service#msd-srv-pxml", session, result)== SOAP_OK)
00239 { printf ("\nPDBe SSM XML Parser Service initialized...\n");
00240 }
00241 else
00242 { printf ("\nPDBe SSM XML Parser Service failed...(Error %d) \n", result);
00243 soap_print_fault(soap, stderr);
00244 soap_print_fault_location(soap, stderr);
00245 }
00246
00247
00248 if (soap_call_ns__msd_conninit(soap, msd_soap_service, "urn:msd_soap_service#msd-conninit",0,result)== SOAP_OK)
00249 { printf ("\nConnection to the PDBe initialized...\n");
00250 }
00251 else
00252 { printf ("Connection failed to the MSD...(Error %d) \n", result);
00253 soap_print_fault(soap, stderr);
00254 soap_print_fault_location(soap, stderr);
00255 }
00256
00257 if (soap_call_ns__msd_server_attach(soap, msd_soap_service, "urn:msd_soap_service#msd-server-attach",0,"msdtrnsd",result)== SOAP_OK)
00258 { printf ("Successfull Attach to the MSD...\n");
00259 }
00260 else
00261 {
00262 printf ("Server not attached.(Error %d) \n", result);
00263 soap_print_fault(soap, stderr);
00264 soap_print_fault_location(soap, stderr);
00265 }
00266 if (soap_call_ns__msd_session_begin(soap, msd_soap_service, "urn:msd_soap_service#msd-session-begin",0,"whouse","whouse",result)== SOAP_OK)
00267 { printf ("Successfull login to the MSD...\nSession begin...\n");
00268 }
00269 else
00270 { printf ("Login failed to the MSD...(Error %d) \n", result);
00271 soap_print_fault(soap, stderr);
00272 soap_print_fault_location(soap, stderr);
00273 }
00274
00275
00276 if(soap_call_ns__msd_sqlinit(soap, msd_soap_service, "urn:msd_soap_service#msd-sqlinit",0,0,sql,result)== SOAP_OK)
00277 { printf ("Successfull SQL initialization...\n");
00278
00279 }
00280 else
00281 { printf ("SQL init failed...(Error %d) \n", result);
00282 soap_print_fault(soap, stderr);
00283 soap_print_fault_location(soap, stderr);
00284 }
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316 if(soap_call_ns__msd_logoff(soap, msd_soap_service, "urn:msd_soap_service#msd-logoff",0,result)== SOAP_OK)
00317
00318 { printf ("\nSuccessfull logoff...\n");
00319 }
00320 else
00321 { soap_print_fault(soap, stderr);
00322 soap_print_fault_location(soap, stderr);
00323 }
00324 if(soap_call_ns__msd_delete_connect_obj(soap, msd_soap_service, "urn:msd_soap_service#msd-delete-connect-obj",0,result)== SOAP_OK)
00325
00326
00327 { printf ("\nSuccessfull delete of connect object...\n");
00328 }
00329 else
00330 { soap_print_fault(soap, stderr);
00331 soap_print_fault_location(soap, stderr);
00332 }
00333 if(soap_call_ns__msd_get_tables_relations(soap, msd_soap_service, "urn:msd_soap_service#msd-get-tables-relations",logs,result)== SOAP_OK)
00334 { printf ("\nSuccessfull Getting Relations...\n");
00335 }
00336 else
00337 { printf ("Getting relations failed...(Error %d) \n", result);
00338 soap_print_fault(soap, stderr);
00339 soap_print_fault_location(soap, stderr);
00340 }
00341 if(soap_call_ns__msd_get_datamodel(soap, msd_soap_service, "urn:msd_soap_service#msd-get-datamodel", logs,result)== SOAP_OK)
00342 { printf ("\nSuccessfull Getting Data Model...\n");
00343 }
00344 else
00345 { printf ("Getting Data Model failed...(Error %d) \n", result);
00346 soap_print_fault(soap, stderr);
00347 soap_print_fault_location(soap, stderr);
00348 }
00349
00350
00351
00352
00353
00354
00355
00356
00357
00359 if (soap_call_ns__varPolyParamTest(soap, msd_soap_service, "urn:msd_soap_service#varPolyParamTest", N, p, r))
00360 soap_print_fault(soap, stderr);
00361 else
00362 { cout << "Server has echoed:" << endl;
00363 for (int i = 0; i < r.__size; i++)
00364 { printf("p[%i] = ",i);
00365 p[i]->print();
00366 cout << endl;
00367 printf("r.param[%i] = ",i);
00368 r.param[i]->print();
00369 cout <<endl;
00370 }
00371 }
00372 for (int i = 0; i < N; i++){
00373 delete p[i];
00374 }
00375 { if (soap_call_ns__varStringParamTest(soap, msd_soap_service, "urn:msd_soap_service#varStringParamTest", argc, argv, n))
00376 soap_print_fault(soap, stderr);
00377 else
00378 printf("Server has responded to %d strings\n", n);
00379 }
00380
00381
00382 printf("</pre></html>\n");
00383
00384 soap_end(soap);
00385 free(soap);
00386 return 0;
00387 }
00388
00389
00391
00392
00393
00395
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00409
00410
00411
00412
00413
00414
00415
00416
00417