Database Reference
In-Depth Information
* and whether the user may open the collection
*
* @param collectionUri The URI of the collection of interest
*
* @return true if the collection exists and the user can open it,
* false if the collection does not exist
*
* @throws PermissionDeniedException
* If the user does not have permission to open the collection
*/
boolean existsAndCanOpenCollection ( final String collectionUri )
throws EXistException , PermissionDeniedException ;
The definition of the Java function existsAndCanOpenCollection should come as no
surprise after seeing the XML-RPC dumps produced by Wireshark. We can clearly
see that the method name, parameters, and method response in the XML-RPC docu‐
ments match the Java definition. This means you can look at any Java function
defined in eXist's XML-RPC API and with relative ease infer what the XML-RPC
document to call it and the response that you will get back should look like.
But wait—as previously mentioned, the XML-RPC API in eXist was not designed
with the idea in mind that developers would directly send and receive XML docu‐
ments to and from it. Rather, as XML-RPC is a standardized protocol, it was
intended to allow any developer to use an XML-RPC client library from her pro‐
gramming language of choice to talk to eXist. An XML-RPC client library makes life
much easier for developers, as they can simply make standard function calls in their
programming language, and the XML-RPC client will take care of serializing these to
XML, sending them to the XML-RPC server API (i.e., eXist) over HTTP, receiving
the responses, deserializing the XML back into the various primitives and objects
defined in their programming language, and returning these results as those of the
function calls they initially made.
So, you may be wondering why we briefly studied the raw wire protocol of XML-RPC
if there are client libraries that we can use to avoid this. Well, in practice there are
many XML-RPC libraries available for many different programming languages, but
they are in various states of maturity. Understanding the underlying XML-RPC pro‐
tocol itself (which is relatively simple) gives us a great tool for gaining insight when
debugging communication problems with eXist using XML-RPC. For reference, the
Linux Documentation Project has an excellent page on using XML-RPC from various
programming languages , complete with practical examples.
Using the XML-RPC client API from Java
There are several options available for XML-RPC libraries in Java. eXist itself makes
use of the Apache XML-RPC library, both for its XML-RPC server and as its underly‐
ing client in the Java Admin Client for remote connections. Here, though, we will
look at the Redstone XML-RPC library , as it is much smaller, simpler, and in many
Search WWH ::




Custom Search