Eider Moore



Saxon is a freely available XSLT/XQuery processor that is written in pure Java. The free version is available from Documentation can be found at It is easy to deploy and use since it is pure Java. It also supports calling Java methods from XQuery (browse the documentation to "Using XQuery"/"Extensibility").


Anglo is an pre-beta product designed to call Web Services from within Saxon.


  • Call a Web Service from Saxon or any other Java based XQuery engine (like Qexo)
  • Not require any external tools or compilation to do so (so no wsdl2java)
  • Provide as simple an interface as possible.
  • Convert atomic strings into documents (I couldn't find how to do this with a builtin function).

Later goals may include supporting popups for authenticating secure Web Services. Only Saxon is currently supported. In order to support Qexo, it would require some testing and moving some Saxon specfic code to a dynamically loaded class.


Add declare namespace anglo="java:edu.washington.biostr.sig.anglo.WebServiceWrapper"; to your XQuery

Type java -cp saxon8.jar:anglo.jar net.sf.saxon.Query 'query file' at the prompt.

It expects Axis in the same directory as anglo or manually setting the classpath to point to Axis (all 8 jars) using -cp.


  • It does not handle converting data types at all... so use a double for a double (not a string)
  • Because the main method takes Java Objects for it's method, Saxon passes StringValues? (instead of Strings) and other constructs that Web Services don't recognize. We need to intelligently break these into the proper types for a given call. Anglo currently converts these to Strings. (The code to do this requires Saxon, so would have to be broken out to support other XQuery engines).
  • Anglo does not handle changing the end point.
  • The interface to call Web Services could be streamlined.



Inversion of Control

Some people may feel understandably queasy about using anglo directly as a form of distributed XQuery. To fix this issue we can apply inversion of control (Wikipedia) to break the dependency chain. By replacing:

declare namespace anglo="java:edu.washington.biostr.sig.anglo.WebServiceWrapper";


import module namespace anglo = """
          at "";

Then our XQuery isn't dependent on anglo and we can substitute different Web Service extensions in other XQuery engines just be changing which dxqFunctions file we import.

Source Home



Anglo requires Saxon (tested with Saxon 8.5 and 8.7) and a JAX-RPC implementation (I suggest Apache Axis as it is the smallest one I have found) to compile. Use the ant build script.

Required Libraries

  1. Saxon
  2. Axis download




declare namespace anglo="java:edu.washington.biostr.sig.anglo.WebServiceWrapper";
let $a := anglo:xquery("", "XQuery", "doXQuery",
return $a

One with two calls:

declare namespace anglo="java:edu.washington.biostr.sig.anglo.WebServiceWrapper";
let $a := anglo:xquery("", "XQuery", "doXQuery",
let $b := anglo:xquery("", "XQuery", "doXQuery",

One that returns an array:

declare namespace anglo="java:edu.washington.biostr.sig.anglo.WebServiceWrapper";
for $d in anglo:wscall(
   "TransformationWS", "transformXYZ", "P174", "MNI", 0.0, 1.0, 2.0)
return <d>{$d}</d>

Converting a String into a document:

declare namespace anglo="java:edu.washington.biostr.sig.anglo.WebServiceWrapper";
let $q := '<q>
   <TransformServerParam coord="Site" source="0" target=""/>
      <Site z0="-3.41681" y0="5.82331" space0="P176" x0="-55.183" space="MNI"/>
      <Site z0="16.3706" y0="-14.5631" space0="P176" x0="-56.8303" space="MNI"/>
for $site in anglo:toDocument($q)//Site
Last modified 15 years ago Last modified on 05/24/06 14:44:35