Accessing Soaplab Web Services

Web Services provided by Soaplab are accessible by using most Web Services client technologies as well as specialised clients provided by Soaplab and other projects. We list below some of the possible ways to access Soaplab Web Services.

Programmatic access to Soaplab Web Services

If you are programming in Java you can use standard Java Web Services stacks as well as Soaplab Client Library which facilitates soaplab client programming in several ways. For other languages you should generally find more user friendly if you write your clients using the typed interface that has been included in Soaplab since version 2.2.

You can find below an example Perl script that use the typed interface. If you use Soaplab client library we have an example Java program below that lists all available Web Services categories in EBI Soaplab server, and also retrieves an example Uniprot entry using the seqret Web Service.

For the Perl example below make sure you have relevant XML::Compile libraries installed and made available to your Perl script. Similarly, for the Java example, you should have Soaplab Client library installed and included in your Java CLASSPATH. You can get Soaplab library using maven or by installing Soaplab in client mode.

Perl example

    #!/usr/bin/perl
    
    use XML::Compile::WSDL11;
    use XML::Compile::Transport::SOAPHTTP;
    use strict;
    
    my $inputs = { 'sequence' => { 'usa' => 'embl:L07770' } };
    
    my $serviceendpoint = 'http://www.ebi.ac.uk/soaplab/typed/services/edit.seqret';
    
    print "Retriving and processing the WSDL and the XSDs imported\n";
    my $wsdl  = XML::LibXML->new->parse_file( $serviceendpoint . '?wsdl' );
    my $proxy = XML::Compile::WSDL11->new($wsdl);
    foreach my $schema ( 1, 2, 3 ) {
        my $xsdXml =
          XML::LibXML->new->parse_file( $serviceendpoint . '?xsd=' . $schema );
        $proxy->schemas->importDefinitions($xsdXml);
    }
    
    print "Generating a request message based on the WSDL\n";
    my $runAndWaitFor = $proxy->compileClient('runAndWaitFor');
    
    print "Calling the service and getting the response\n";
    my ( $answer, $trace ) = $runAndWaitFor->($inputs);
    
    my %answer          = %{$answer};
    my %answer_         = %{ $answer{'runAndWaitForResponse'} };
    my $report          = $answer_{'report'};
    my $detailed_status = $answer_{'detailed_status'};
    my $outseq          = $answer_{'outseq'};
    my $outseq_url      = $answer_{'outseq_url'};
    
    print "\nJob report received:\n----------------------------\n\n$report\n";

Java example, using Soaplab client library

    static SoaplabBaseClient getClient(String endpoint) {
        ServiceLocator locator = new ServiceLocator();
        locator.setProtocol(ClientConfig.PROTOCOL_AXIS1);
        locator.setServiceEndpoint(endpoint);
        try {
            return new SoaplabBaseClient(locator);
        } catch (SoaplabException e) {
            e.printStackTrace();
            System.exit(1);
        }
        return null;
    }
 
    static void printCategories() {
        SoaplabBaseClient client = getClient("http://www.ebi.ac.uk/soaplab/services");
        String[] catgs = client.getAvailableCategories();
        for (String category : catgs) {
            System.out.println(" - " + category);
        }
    }
 
    public static void main(String[] arg) {
        printCategories();
        SoaplabBaseClient client = getClient("http://www.ebi.ac.uk/soaplab/services/edit.seqret");
        Map inputs = new HashMap();
        inputs.put("sequence_usa", "uniprot:p12345");
        try {
            SoaplabMap results = client.runAndWaitFor(SoaplabMap
                    .fromMap(inputs));
            Map outputs = SoaplabMap.toMap(results);
            System.out.println("sequence retrieved: " + outputs.get("outseq"));
        } catch (SoaplabException e) {
            e.printStackTrace();
        }
    }

Last modified: Mon Feb 4 17:24:39 2008