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

PerlClientFile.pl

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

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