Web Services

We have two types of web services

  • Plain HTTP GET request: use the XQuery document() function (these are sort-of REST style, aka Plain Old XML (POX) or CGI params
  • SOAP: requires AngloSaxon XQuery extension library (or similar); can send longer queries via HTTP POST.

Plain HTTP GET Services

For most of these you can click on the link and get a simple HTML page to type queries into. Please save your queries in text files or DXbrain!

SOAP Web Services

Wiki pages and WSDL locations

Term confusion

By the way, SOAP Web Service 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 with the SOAP Web Service port TransformationServer and the SOAP Web Service 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 You usually don't need to know the endpoint, since most clients generate it using information in the WSDL.

Example clients

These examples query a SaxonWebService; for the syntax used with the other services, see their individual wiki pages.

Example: AngloSaxon

AngloSaxon is Eider's extension to Saxon (an open source XSLT/XQuery processor) designed to call SOAP Web Services.

let $q := 

let $a := anglo:xquery("", "XQuery", "doXQuery", $q)

Example: Apache Axis

This example is modified from the Apache Axis documentation, save this as

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 = "";
           Service  service = new Service();
           Call     call    = (Call) service.createCall();

           call.setTargetEndpointAddress( new );
           call.setOperationName(new QName("", "doXQuery") );

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

           String xquery = ""+
             "<results> {"+ 
           String ret = (String) call.invoke(new Object[] {xquery});

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

On SIG Linux machines, you can compile and run with:

javac -cp $CP 
java -cp $CP testClient

Example: perl SOAP::Lite

For more information see, especially Access with service description (WSDL))

use SOAP::Lite;
# if you want debug output including SOAP faults add '+trace':
#use SOAP::Lite +trace;
$q = '
let $p := $pv/patient[pnum=117] 
return $p/pnum
print SOAP::Lite
  -> service("")
  -> doXQuery("$q");
print "\n";
Last modified 10 years ago Last modified on 06/11/11 16:22:25