wiki:WebServices

Version 1 (modified by joshuadf, 12 years ago) (diff)

--

Our current Web Services include:

SOAP:

Non-SOAP:

Term confusion

By the way, Web Services terms overload common terms which causes some confusion. Here is a rough correspondence:

  • port: like Java Class, Perl module, etc.
    • operation: like Java Method, Perl function, etc.; may take parameters

So you call the TransformationServer running on femur port 8080 with the Web Services port name TransformationServer and the Web Services operation transformXML. Documentation may also refer to the "endpoint" or "location" which is a full URL including server and path where the SOAP client POSTs its message; in this case the endpoint is http://femur.biostr.washington.edu:8080/Transformer/services/TransformationWS

Example clients

Using Eider's AngloSaxon:

let $q := 
"
<results> 
{ 
$pv/patient[pnum=50]/pnum
} 
</results>
"

let $a := anglo:xquery("http://xbrain.biostr.washington.edu:8080/xcsm/wsdl/SilkRouteWebService.wsdl",
"SilkRouteWebService", "queryDatabase", $q)
return 
<foo>
{$a}
</foo>

From the Apache Axis documentation:

// http://www.apache.org/licenses/LICENSE-2.0
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;

public class testClient
{
   public static void main(String [] args) {
       try {
           String endpoint = "http://xbrain.biostr.washington.edu:8080/xcsm/services/SilkRouteWebService";
     
           Service  service = new Service();
           Call     call    = (Call) service.createCall();

           call.setTargetEndpointAddress( new java.net.URL(endpoint) );
           call.setOperationName(new QName("http://soapinterop.org/", "queryDatabase") );

           call.addParameter("xquery", org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
           call.setReturnType(org.apache.axis.Constants.XSD_STRING);

           String xquery = ""+
             "<results> {"+ 
             "$pv/patient[pnum=50]/pnum"+ 
             "}</results>";
           String ret = (String) call.invoke(new Object[] {xquery});

           System.out.println("QUERY: \n" + xquery + "\nRESULTS: \n\n" + ret + "\n");
       } catch (Exception e) {
           System.err.println(e.toString());
       }
   }
}

Using perl SOAP::Lite

#!/usr/bin/perl
# http://guide.soaplite.com/
# http://guide.soaplite.com/#access%20with%20service%20description%20%28wsdl%28
use SOAP::Lite;
#use SOAP::Lite +trace;
$q = '
<results> 
{ 
 for $p in $pv/patient[pnum=54] 
 return 
 <patient> 
  {$p/pnum} 
  </patient>
 } 
</results>
';
print SOAP::Lite
  -> service("http://xbrain.biostr.washington.edu:8080/xcsm/wsdl/SilkRouteWebService.wsdl")
  -> queryDatabase("$q");
print "\n";