Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

PerlClientTester.pl

00001 #!perl
00002 
00003 #---------------------------------------------------
00004 # PerlClientTester.pl
00005 # 
00006 # Project: PDBe API Framework 
00007 # Module:  Perl Client for PDBe API Webservice (SOAP) Server 
00008 # to get files through SOAP 64 bit binary format
00009 # 
00010 # SOAP User Layer
00011 # Last updated: 25 February 2004 10:17
00012 # (C) Siamak Sobhany
00013 #---------------------------------------------------
00014  
00015 use SOAP::Lite;
00016 use IO::File;
00017 
00018 my $service = SOAP::Lite
00019   ->uri('urn:msd_soap_service')
00020   ->proxy('http://www.ebi.ac.uk/msd-srv/msdsoap'); # Or:
00021 # -> service('http://www.ebi.ac.uk/msd/api/msd_soap_service.wsdl');
00022  my $query = '<SSMInput><query><type>PDB entry</type> '.
00023   ' <pdbcode>1pmb</pdbcode> </query><target><type>PDB archive</type>'. 
00024   '</target> <selection>  <type>Chain(s)</type>   <chains>*(all)</chains>'.   
00025   '</selection> <percent1>70</percent1>   <percent2>70</percent2>'.
00026   '<sepchains>Yes</sepchains> <connectivity>Yes</connectivity>  '.
00027   '<bestmatch>Yes</bestmatch> <uniquematch>Yes</uniquematch> '.
00028   '<precision>Normal</precision> <sorting>RMSD</sorting>'.
00029   '</SSMInput> ';  
00030 my $sessionid = 'mysessionnumber';  
00031 my $array = [$query , $sessionid];
00032 print "\nCalling method: msdSSM()\n";
00033 my $result1 = $service->msdSSM(SOAP::Data->name('numofpars' => 2),
00034                                SOAP::Data->name('inparams' => $array));
00035 unless ($result1->fault) {
00036     print "\nmsdSSM() called successfully.\n";
00037         print $result1->result();
00038 }else{
00039         print join  ', ', 
00040         $result1->faultcode, 
00041     $result1->faultstring;
00042 }
00043 for ($i=1; $i > 0 ; $i++) 
00044  { my $result2 = $service->msdGetSoapBase64Data(SOAP::Data->name('diyf')->type('xsd:int')->value(1), # 0
00045                           SOAP::Data->name('sessionid')->type('xsd:string')->value($sessionid));
00046                   unless ($result2->fault || ($result2->faultstring != 'Result fille not ready')) {
00047           $i=-1;
00048                   print $result2->result();
00049                   $fh = new IO::File "> my_result.xml";
00050           if (defined $fh) {
00051             print $fh $result2->result();
00052             $fh->close;
00053                     print "\nResult file created successfully:\n";
00054           }
00055                   }else{
00056                         print join  ', ', 
00057                         "\nXML File not ready...retry: $i ",
00058                         $result2->faultcode, 
00059             $result2->faultstring;
00060                   }
00061           sleep(5);
00062   }
00063         
00064  
00065   
00066   

Generated on Fri Apr 16 13:47:45 2004 for MSDAPI by doxygen 1.3.4-20031005