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 'bioinfo.icapture.ubc.ca'
CentralImpl central = new CentralImpl();

// set the signature url to be the url
MobyService template = new MobyService("getGoTerm","bioinfo.icapture.ubc.ca");
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!

Notes

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 = org.biomoby.shared.data.MobyDataUtils.fromXMLDocument(new 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!

[webservice:edit]

Notes

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.

Specifically

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.

 Resources:

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                :   http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl

Namespace (URI)            :   http://mobycentral.icapture.ubc.ca/MOBY/Central

 Testing Registry:

Endpoint / URL               :    http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl

Namespace (URI)           :    http://bioinfo.icapture.ubc.ca/MOBY/Central&nbsp;

JMoby (Java BioMOBY) API:


http://biomoby.open-bio.org/CVS_CONTENT/moby-live/Java/docs/API/index.html

Labels
  • None