DIY (Do-It-Yourself) Clients   

Of course, as for many Web Services, you can develop clients using the code generated from their WSDL descriptions. Also for the Bionanny Web Service you can use Axis's wsdl2java tool to get Java client stubs, or SOAP::Lite's tool stubmaker to get Perl stubs.

However, if you want to write your clients without generated stubs, here are short examples in Java and Perl:

  Client in Java

package org.bionanny.samples;

import org.bionanny.shared.Bionanny;
import embl.ebi.soap.axis.AxisCall;

public class GetAllDataClient {

  public static void main (String [] args)
    throws Exception {

    AxisCall call =
      new AxisCall (new URL ("http://localhost:8080/axis/services/bionanny"));
    Object[] params =
      new Object[] { new Integer (Bionanny.CUMULATED_FOR_SERVICES), // level
        new String[] {},                               // service names
        new Long (0),                                  // period from
        new Long (0),                                  // period to
        new String[] {}                                // metadata names
    System.out.println ((String)call.doCall ("getAsXML", params));

You can start such client by typing:

build/run/run-any-client org.bionanny.samples.GetAllDataClient

  Client in Perl


use strict;
use Bionanny::Listener;

my $listener =
  new Bionanny::Listener (-location => 'http://localhost:8080/axis/services/bionanny');
print $listener->get (-level => $listener->CUMULATED_FOR_SERVICES,
		      -humandates => 1);

You can start such client by typing:

cd build/run

Above, the cd build/run is because the script must know about package Bionanny::Listener. You can, of course, make it known in any other Perl ways. For example, by setting export PERL5LIB=.../bionanny/build/run.

Knowing that the location used above is a default one, and that the constant CUMULATED_FOR_SERVICES equals actually 1, you can make the same call as a Perl one-liner (well, now you get dates in a less human readable format):

perl -MBionanny::Listener -e 'print new Bionanny::Listener->get(-level, 1)'

Martin Senger, Mike Niemi
Last modified: Sun Apr 10 12:50:56 2005