Connecting to MOBY Central in Perl and Java

Connecting toMOBY-Central

  • MOBY Central lives at the iCAPTURE Centre for Cardiovascular and
    Pulmonary Research, St. Paul’s Hospital, Vancouver, BC, Canada.

    “Select” privileves
    have been granted to the following login:

user: moby_external
password: <<none>>
server address: mobycentral.icapture.ubc.ca       

The default SOAP endpoints being used in the code examples below
are:


URL:  http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl
URI:  http://mobycentral.icapture.ubc.ca/MOBY/Central

You should use these in any custom code you design, unless you know the endpoints of another MOBY Central API.

  • The more usual way to connect to MOBY-Central is through the SOAP service
    that talks to it, using either the Perl or the Java interface. The following
    scripts show how to connect to MOBY Central’s soap
    interface.

    IN PERL:


  use MOBY::Client::Central;
  my $Central = MOBY::Client::Central->new;

  # a simple MOBY_Central call to get service types
  my $types = $Central->retrieveServiceTypes;
  print "KNOWN SERVICE TYPES\n";
  while (my ($type, $def) = each %{$types}){
		print "$type : $def\n";
	}


IN JAVA:


	import org.biomoby.shared.*;
	import org.biomoby.client.*;
	import java.util.*;

	public class RetrieveServiceTypes {
	public static void main (String [] args) {
	try {
	    Central worker = new CentralImpl (CentralImpl.DEFAULT_ENDPOINT,
	                                         CentralImpl.DEFAULT_NAMESPACE);
	    System.out.println ("KNOWN SERVICE TYPES\n");
	    Map types = worker.getServiceTypes();
	    for (Iterator it = types.entrySet().iterator(); it.hasNext();) {
	      Map.Entry entry = (Map.Entry)it.next();
	      System.out.println (entry.getKey());
	      System.out.println ("\t" + entry.getValue());
	    }
	  } catch (Exception e) {
	    System.err.println ("===ERROR===");
	    System.err.println (e.toString());
	    System.err.println ("===========");
	  }
	}
   }

 

Leave a Reply