Skip to end of metadata
Go to start of metadata

Discovering and Invoking Moby Services

Find a service and then call it

// let's find the service 'getGoTerm' from the authority ''
CentralImpl central = new CentralImpl();

// set the signature url to be the url
MobyService template = new MobyService("getGoTerm","");
MobyService[] foundservices = central.findService(template);

// since the service name and authority uniquely identify a service, there should be at most one returned!
MobyService myService = foundservices0;

// here you have set the input (hint: dashboards' simple client is useful here!)
String inputXML = "";
String output = new MClient().doCall(myService.getName(), myService.getURL(), new Object[]

// now do whatever you want to do to the output XML!


This example is only one example of a client that you can use to call moby services in JAVA.

Martin Senger and Paul Gordon have written much nicer ones and you can find examples below:

Specific Examples *

Parsing the Output XML from a Service (without parsing XML!)

The following helps you initially start to parse the XML.

Please note, currently, this method only works if the 'default' registry has your datatypes registered within it!

MobyContentInstance contents;
String xml = "YOUR_XML_INPUT_HERE";

try {
contents = ByteArrayInputStream(xml.getBytes("UTF8")));
catch (Exception e) {
System.err.println("Are you sure that the input 'xml' is really XML?", e.getLocalizedMessage());

Now use 'Data Package In Anger' page!



There are many ways to parse the XML. Another method would be to use the java class called 'MobyPackage'.

All you have to invoke the .createFromXML() method. This will return an encapsulate the XML as an Object and you are free to call methods on it.

More detail can be found here.


N.B. Use of the package MobyPackage assumes that you have all of the datatypes 'generated' using dashboard and the library, biomoby-datatypes.jar, on the class path.


BioMoby Registry Location

Two required attributes to connect to a BioMoby Registry are:

  1. URL: <URL> ia an endpoint of a Moby registry.
  2. Namespace :<namespace> is a URI defining Moby registry's namespace.

 Default / Production Registry:

Endpoint / URL                :

Namespace (URI)            :

 Testing Registry:

Endpoint / URL               :

Namespace (URI)           :;

JMoby (Java BioMOBY) API:

  • None