6.2 Using XRPC from Java

WARNING: XRPC still makes use of the old compiler backend and does not use the optimizing algebraic query compiler. Therefore, its query performance can sometimes be inferior to other queries handled by MonetDB/XQuery. Also, as the old compiler backend is gradually phased out, it gets to be less well-maintained and tested in general. Use with caution. We hope to port XRPC to the algebra backend soon.

XRPC allows to make SOAP calls to a MonetDB/XQuery server. With XRPC you can invoke predefined XQuery Functions. The XQuery function must be defined in an XQuery Module file that should be accessible by the server via an URL.

Because XRPC makes use of such predefined modules, MonetDB/XQuery can pre-process the module and perform query optimization beforehand. This makes XRPC a highly efficient API, allowing in simple queries for response times of for less than 10 milliseconds.

By default when MonetDB/XQuery starts, its HTTP server is started on port 50001. It serves out the directory is in share/xrpc/. This HTTP server interprets POST requests that have a local URI starting with /xrpc as XRPC requests. Inside the POST request body is a SOAP request, and the returned answer is a SOAP message again. This API creates a valid SOAP request, sends it, and calls a callback function when the response comes in.

WARNING: XRPC still makes use of the old compiler backend and does not use the optimizing algebraic query compiler. Therefore, its query performance can sometimes be inferior to other queries handled by MonetDB/XQuery. Also, as the old compiler backend is gradually phased out, it gets to be less well-maintained and tested in general. Use with caution. We hope to port XRPC to the algebra backend soon.

6.2.1 API

The Java client API is defined in package nl.cwi.monetdb.xquery.util, and is included in both the XRPC wrapper ($prefix/share/MoneDB/lib/xrpcwrapper.jar) and the test client of the XRPC wrapper ($prefix/share/MoneDB/lib/xrpcwrapper-test.jar) 1. The test client program ($prefix/share/MoneDB/lib/xrpcwrapper-test.jar) of the XRPC Wrapper is a complete example for using the Java client API.

The JavaDoc can be found here.


Footnotes

[1] (Note: the Java client API will be released in a separate JAR package in the next release of MonetDB/XQuery.)