spacer

PDBe API Examples

To run and test the clients...

  1. A SOAP implementation tool in your favorite language should be selected. We have used popular tools like: Apache Axis, SOAP::Lite, NuSOAP, ... but more options and implementations can be found at: http://www.soapware.org/directory/4/implementations
  2. Download and install selected SOAP implementation tool according to installation instructions of the SOAP tool.
  3. Selected SOAP tool may need to use and import a WSDL file for the web service. This file can be found at this URL: msd_soap_service.wsdl. You may save this file locally to import to the SOAP tool, and generate the codes needed for SOAP.
  4. All these examples try to connect to a multi threaded, stand-alone PDBe API SOAP Server as a Beta system, with this End point URL Address:  http://www.ebi.ac.uk/msd-srv/msdsoap Most of methods in this web service require a session number as a parameter / argument to track and refer in later calls. So we should provide unique session number/name as (Type: String) and avoid using common or repeated strings.
  5. API SOAP Server methods are available outside the firewall, partly for trusted users only and partly for all users. So security layer requires authentication for some of methods such as msdExecQuery(). In such cases you should provide valid username and password isued by PDBe in your application code just before calling these methods.If a method requires authentication, when you call it whthout valid username and password, you receive an error message for authentication. If you want to be an authorized user, send an email to: msdapi
  6. If you are using Apache Axis, when using WSDL2Java tool to import the WSDL file and create wrapper code, according to the version of Apache Axis, you may need to change the package name in the client example from : msd_soap_service_pkg to: msd_soap_service and also change Msd_soap_service prefix in classnames to: Msd_Soap_Service (because this prefix is autogenerated and depends on Appache Axis's version).
  7. If you are using gSOAP, it's easier to download this initial gsoap header file: wscclient.h , rather than importing the WSDL file, because the earlier process, first creates a header file to import to gSOAP compiler: soapcpp2 so it's easier to import the initial header file directly to the soapcpp2 compiler.

Example for Client of The PDBe SSM Web Service provides a result in XML format for a given XML string including input data, see Secondary Structure Matching Tool for details of this system. The sample of input XML string for this method is:

<SSMInput>
 <program>
  SSM v1.38 // 30/06/2003 // by Eugene B. Krissinel,
  European Bioinformatics Institute, Hinxton, Cambridge CB1 9SD, UK
 </program>
 <query>
  <type>PDB entry</type>
  <pdbcode>1sar</pdbcode>
 </query>
 <target>
  <type>PDB archive</type>
 </target>
 <selection>
   <type>Chain(s)</type>
   <chains>*(all)</chains>
 </selection>
 <percent1>70</percent1>
 <percent2>70</percent2>
 <sepchains>Yes</sepchains>
 <connectivity>Yes</connectivity>
 <bestmatch>Yes</bestmatch>
 <uniquematch>Yes</uniquematch>
 <precision>Normal</precision>
 <sorting>RMSD</sorting>
</SSMInput>  

The WSDL description of the SSM Web Service provides the following details:

Endpoint URL: 

http://www.ebi.ac.uk/msd-srv/msdsoap

SOAP action: 

""  

Remote method namespace: 

urn:msd_soap_service

Remote method name: 

msdSSM

Input parameter: 

numofpars of type xsd:int


inparams of type ns:ArrayOfanyType

Output parameter: 

Result of type xsd:int

Using the WSDL importer tool from your SOAP toolkit for your desired language, for example in Java you may use Apache Axis, or in Perl, use SOAP::Lite, or in PHP use NuSOAP you can import the WSDL file msd_soap_service.wsdl and generate SOAP wrappers ready to call from your application.

#!perl

use SOAP::Lite;
print SOAP::Lite
-> service('/msd/api/msd_soap_service.wsdl')
-> msdSSM( 2 , ['<SSMInput>'.
'<program>'.
'SSM v1.38 // 30/06/2003 // by Eugene B. Krissinel,'.
'European Bioinformatics Institute,'.
'Hinxton, Cambridge CB1 9SD, UK'.
'</program>'.
'<query>'.
'<type>PDB entry</type>'.
'<pdbcode>1sar</pdbcode>'.
'</query>'.
'<target>'.
'<type>PDB archive</type>'.
'</target>'.
'<selection>'.
'<type>Chain(s)</type>'.
'<chains>*(all)</chains>'.
'</selection>'.
'<percent1>70</percent1>'.
'<percent2>70</percent2>'.
'<sepchains>Yes</sepchains>'.
'<connectivity>Yes</connectivity>'.
'<bestmatch>Yes</bestmatch>'.
'<uniquematch>Yes</uniquematch>'.
'<precision>Normal</precision>'.
'<sorting>RMSD</sorting>'.
'</SSMInput>', 'my_session_number' ]);  

Here is the Perl example with another method to get the SSM result as XML:

#!perl

use SOAP::Lite;
use IO::File;
my $service = SOAP::Lite
  ->uri('urn:msd_soap_service')
  ->proxy('http://www.ebi.ac.uk/msd-srv/msdsoap'); # Or:
# -> service('/msd/api/msd_soap_service.wsdl');

my $query = '<SSMInput> <query> <type>PDB entry</type> <pdbcode>1sar</pdbcode>'.
'</query> <target> <type>PDB archive</type>'.
'</target> <selection> <type>Chain(s)</type>'.
'<chains>*(all)</chains> </selection> <percent1>70</percent1>'.
'<percent2>70</percent2> <sepchains>Yes</sepchains>'.
'<connectivity>Yes</connectivity> <bestmatch>Yes</bestmatch>'.
'<uniquematch>Yes</uniquematch> <precision>Normal</precision>'.
'<sorting>RMSD</sorting> </SSMInput>';

my $sessionid = 'mysessionnumber';
my $array = [$query , $sessionid];
print "\nCalling method: msdSSM()\n";
my $result1 = $service->msdSSM(SOAP::Data->name('numofpars' => 2),
   SOAP::Data->name('inparams' => $array));
unless ($result1->fault) {
  print "\nmsdSSM() called successfully.\n";
  print $result1->result();
}else{
  print join ', ',
  $result1->faultcode,
  $result1->faultstring;
}
for ($i=1; $i > 0 ; $i++)
  { my $result2 = $service->msdGetSoapBase64Data(SOAP::Data->name('diyf')->type('xsd:int')->value(1),
   SOAP::Data->name('sessionid')->type('xsd:string')->value($sessionid));
   unless ($result2->fault || ($result2->faultstring != 'Result fille not ready')) {
   $i=-1;
   print $result2->result();
   $fh = new IO::File "> my_result.xml";
   if (defined $fh){
    print $fh $result2->result();
    $fh->close;
    print "\nResult file created successfully:\n";
   }
   }else{
   print join ', ',
   "\nXML File not ready...retry: $i ",
   $result2->faultcode,
   $result2->faultstring;
   }
   sleep(5);
}
   my $result3 = $service->msdSSMPurge(SOAP::Data->name('sessionid')->type('xsd:string')->value($sessionid));
   unless ($result3->fault) {
   print "\nmsdSSMPurge() called successfully.\n";
   print $result3->result();
  }else{
   print join ', ',
   $result3->faultcode,
   $result3->faultstring;
 }
 

Primary developer: Siamak Sobhany
last modified: 31/03/04


Document mantained by: Gaurav Sahni
spacer
spacer