G::Tools WebServices
SummaryIncluded librariesPackage variablesDescriptionGeneral documentationMethods
Summary
    G::Tools::WebServices - Interface to web services, including BioMOBY
Package variables
No package variables defined.
Included modules
G::Messenger
SelfLoader
SubOpt
Inherit
Exporter
Synopsis
No synopsis!
Description
    This class is a part of G-language Genome Analysis Environment, 
    collecting interfaces to web services.
Methods
wsDescriptionCode
Methods description
wscode    nextTop
 Name: ws   -   runs web services through BioMOBY

 Description:
    This is a wrapper around MOBY::Client::Service to run web services
    through BioMOBY. Use help -w  to search for web services,
    help -w  to view service description. 
    
 Usage:
    ws(, $argument1=>$ontology_or_namespace, ...);

    arguments are given as hash, where the key is the argument and the 
    value is the MOBY ontology or Namespace.

    ex: 
      ws('MOBYSHoundGetGenBankWhateverSequence', 'EX5B_ECOLI'=>'Swiss-Prot')

 Options:
    None.  

 References:
   1. Wilkinson MD, Links M (2002) "BioMOBY: an open source biological web services
      proposal.", Brief Bioinform., 3(4):331-341.
   2. Wilkinson M, Schoof H, Ernst R, Haase D (2005) "BioMOBY successfully integrates 
      distributed heterogeneous bioinformatics Web Services. The PlaNet exemplar case.",
      Plant Physiol., 138(1):5-17.

 Author: 
    Kazuharu Arakawa (gaou@sfc.keio.ac.jp)
History: 20080227-01 initial posting
Methods code
wsdescriptionprevnextTop
sub ws {
    my $service = shift;

    require MOBY::Client::Central;
    require MOBY::Client::Service;
    my $m = MOBY::Client::Central->new();
    my %ns = %{$m->retrieveNamespaces()};

    my ($sv, $reg) = $m->findService(serviceName=>$service);
    die("Web Service: $service not found.") unless($sv);

    my @inputlist;
    my %hash = @_;
    
    foreach my $input (@{$$sv[0]->{input}}){
	my ($query, $name) = each %hash;
	last unless($query);

	my $article = $input->articleName();
	my $xml = ($ns{$name}) ? '<Object id="'.$query.'" namespace="'.$name.'"/>' : '<'.$name.' id="'.$query.'"/>';
	push(@inputlist, [$article, $xml]);
    }

    my $wsdl = $m->retrieveService($$sv[0]);
    my $serv = MOBY::Client::Service->new( service => $wsdl );
    my $result =  $serv->execute(XMLinputlist => [@inputlist]);

    $result =~ s/\n/=%=/g;

    if($result =~ /<moby:Simple.*?>(.*)<\/moby:Simple>/){
	my $res = $1;
	$res =~ s/=%=/\n/g;
	return $res;
    }
}
General documentation
No general documentation available.