User Tools

Site Tools


kbws

KBWS SOAP Service

KBWS SOAP Service is the proxy web service to access Keio Bioinformatics Web Service (KBWS) via SOAP service. Detail documentation about KBWS is available from here.

WSDL file

Sample Code

RPC Encoded

Perl

using SOAP::Lite (0.60)

#!/usr/bin/perl
use SOAP::Lite;
 
my $seq = `cat test.fasta`;
 
my $soap  = SOAP::Lite->service("http://soap.g-language.org/kbws.wsdl");
my $inputParams = SOAP::Data->name("params")->type(map => { "d" => "swissprot" });
 
my $jobid = $soap->runBlast($seq, $inputParams);
 
sleep 3 while ( $soap->checkStatus($jobid) == 0 );
 
print $soap->getResult($jobid);
Ruby

using soap4r

#!/usr/bin/env ruby
require 'KBWSDriver.rb'
 
# create WSDL driver
endpoint_url = ARGV.shift
obj = KBWS.new(endpoint_url)
 
# input sequence data (fasta format)
file = open("test.fasta")
parameters = { "in0" => file.read, "params" => { "d" => "swissprot" } }
 
# run your job
jobid = obj.runBlast( parameters )
 
print jobid.s_gensym3
 
# polling your job
while obj.checkStatus( jobid ).s_gensym3 == 0
   sleep 3
end
 
# get result
puts obj.getResult( jobid ).s_gensym3
Python

using SOAPpy

#!/usr/bin/python
 
from SOAPpy import WSDL
 
# create WSDL driver
wsdl = 'http://soap.g-language.org/kbws.wsdl'
serv = WSDL.Proxy(wsdl)
 
# input sequence data (fasta format)
for line in open('test.fasta','r')
   file + line
 
# run your job
jobid = serv.runGlimmer(file,'')
 
# polling your job
status = serv.checkStatus(jobid)
while status == 0:
   sleep(3)
   status = serv.checkStatus(jobid)
 
# get result
results = serv.getResult(jobid)
 
print results
Java

using Apache Axis (>1.4)

import java.io.*;
import kbws.*;
 
class runBlast {
    public static void main(String[] args) throws Exception {
        KBWSServiceLocator  locator = new KBWSServiceLocator();
        KBWS_PortType serv    = locator.getKBWS();
 
        FileReader in = new FileReader("/home/kbws/test.fasta");
        BufferedReader br = new BufferedReader(in);
 
        String in0 = "";
        String line;
        while ((line = br.readLine()) != null) {
            in0 = in0 + line + "\n";
        }
 
        BlastInputParams parameter = new BlastInputParams();
        parameter.setD("swissprot");
 
        System.out.println (serv.runBlast( in0, parameter ) );
    }
}

Document/Literal

Perl

use SOAP::Lite (0.712)

#!/usr/bin/env perl
use SOAP::Lite;
use MIME::Base64;
 
use strict;
use warnings;
 
my $soap = SOAP::Lite->new( proxy => 'http://soap.g-language.org/kbws/kbws.cgi');
$soap->autotype(0);
$soap->default_ns('urn:KBWS');
 
my $seq = `cat test.fasta`;
$seq = encode_base64($seq);
 
my %param = (
             d => "swissprot",
            );
 
my $blast = $soap->on_action( sub{"urn:KBWS#runBlast"} );
 
my $jobid = $blast->runBlast(
                             SOAP::Data->name('in0')->value($seq),
                             SOAP::Data->name('params')->value(%param),
                            )->result();
 
print "jobid : ".$jobid."\n";
 
my $poll = $soap->on_action( sub{"urn:KBWS#checkStatus"} );
sleep 3 while ( $poll->checkStatus( SOAP::Data->name('jobid')->value($jobid) )->result() == 0 );
 
print $soap->on_action( sub{"urn:KBWS#getResult"} )->getResult( SOAP::Data->name('jobid')->value($jobid) )->result();
Ruby
using soap4r
 
#!/usr/bin/env ruby
require 'KBWSDriver.rb'
 
endpoint_url = ARGV.shift
obj = KBWS.new(endpoint_url)
 
# run ruby with -d to see SOAP wiredumps.
obj.wiredump_dev = STDERR if $DEBUG
 
file = open("test.fasta")
parameters = { "in0" => file.read, "params" => {"d" => "swissprot" } }
 
jobid = obj.runBlast( parameters )
 
print jobid.s_gensym3
 
while obj.checkStatus( jobid ).s_gensym3 == 0
   sleep 3
end
 
puts obj.getResult( jobid ).s_gensym3
Java

require Apache Axis (>1.4)

import java.io.*;
import kbws.*;
 
class runBlast {
    public static void main(String[] args) throws Exception {
        KBWS_ServiceLocator  locator = new KBWS_ServiceLocator();
        KBWS_PortType serv    = locator.getKBWSHttpPort();
 
        FileReader in = new FileReader("/home/kbws/test.fasta");
        BufferedReader br = new BufferedReader(in);
 
        String in0 = "";
        String line;
        while ((line = br.readLine()) != null) {
            in0 = in0 + line + "\n";
        }
 
        BlastInputParams parameter = new BlastInputParams();
        parameter.setD("swissprot");
 
        String jobid = serv.runBlast( in0, parameter );
        System.out.println ( jobid );
 
        while ( serv.checkStatus( jobid ) == 0 ) {
            Thread.sleep(3000);
        }
 
        System.out.println( serv.getResult( jobid ) );
 
    }
}
kbws.txt · Last modified: 2014/01/18 07:44 (external edit)