[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at dev.open-bio.org
Tue Jan 28 21:51:46 UTC 2003
Tue Jan 28 16:51:45 EST 2003
Update of /home/repository/moby/moby-live/Perl/Client
In directory dev:/tmp/cvs-serv19891/Perl/Client
Modified Files:
central_connection_example.pl complex_client.pl
simple_client.pl
Log Message:
A total rewrite of the MOBY Central interface, along with a rewrite of the Perl client-side wrapper. MOBY Central is no longer object oriented (->new method is deprecated), all messages are XML objects rather than Perl objects, some additional methods have been added to deregister namespaces and service types, i fixed some of the SQL logic that was faulty, and i cleaned up the return data so that it is consistent from call to call. i have fixed the various client scripts here in the Perl repository, but I have not yet fixed the CGI-based client running at CBR Halifax, nor have I updated the public MOBY::Central with this new code. I will do that within the next 24 hours - in the meantime, you may well find that everything is broken. Once everything is uploaded and tweaked I will update the documentation on the BioMOBY website to reflect the new API. In the meantime, you can get the latest documentation from Perldoc or pod2html.
moby-live/Perl/Client central_connection_example.pl,1.1,1.2 complex_client.pl,1.1,1.2 simple_client.pl,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/Client/central_connection_example.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/T0rvaq8M 2003-01-28 16:51:46.000004097 -0500
+++ /tmp/T1svaq8M 2003-01-28 16:51:46.010007892 -0500
@@ -2,8 +2,8 @@
use lib "../Client";
use MOBY::Client::Central;
-my ($Central) = MOBY::Client::Central->new(MOBY_server => 'http://michael.cbr.nrc.ca/cgi-bin/MOBY-Central.pl',
- MOBY_uri => 'http://michael.cbr.nrc.ca/MOBY/Central');
+my ($Central) = MOBY::Client::Central->new(MOBY_server => 'http://mobycentral.cbr.nrc.ca/cgi-bin/MOBY-Central.pl',
+ MOBY_uri => 'http://mobycentral.cbr.nrc.ca/MOBY/Central');
# a simple MOBY_Central call to get service types
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/Client/complex_client.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /tmp/T0.va48M 2003-01-28 16:51:46.050008493 -0500
+++ /tmp/T1_va48M 2003-01-28 16:51:46.090009814 -0500
@@ -3,8 +3,9 @@
use MOBY::Client::Central;
use MOBY::Client::Service;
-#my $Central = MOBY::Client::Central->new(MOBY_server => "http://192.168.1.9/cgi-bin/MOBY-Central.pl");
-my $Central = MOBY::Client::Central->new(MOBY_server => "http://bioinfo.pbi.nrc.ca:8099/cgi-bin/MOBY-Central.pl");
+my $Central = MOBY::Client::Central->new(
+ MOBY_server => "http://mobycentral.cbr.nrc.ca/cgi-bin/MOBY-Central.pl",
+ MOBY_uri => "http://mobycentral.cbr.nrc.ca/MOBY/Central");
my $ObjectNames = $Central->retrieveObjectNames;
my $ServiceTypes = $Central->retrieveServiceTypes;
@@ -59,42 +60,45 @@
# QUERY MOBY-Central FOR THAT SERVICE
print "\n\nLooking for services that use $NS ID's as input to a $SERV : $SERV_DESC...";
-my %services = $Central->locateServiceByInput(['Object'], [$NS], $SERV);
+my @services = $Central->locateServiceByInput(
+ input => {'Object' => [$NS]},
+ serviceType => $SERV);
-my $SelectedService;
-if (scalar(keys %services)){
- while (!$SelectedService){
- my $x = 0; my @names;
- while (my ($ServiceName, $TYPE) = each %services){
- push @names, $ServiceName;
- my ($URI, $name) = (($ServiceName =~ /(.+?)#(.+)/) && ($1, $2));
- my ($type, $desc) = (($TYPE =~ /(.+?)\;(.+)/) && ($1, $2));
-
- print "\nFound Service #$x:\n".
- "\tFrom: $URI\n".
- "\tName: $name\n".
- "\tType: $type\n".
- "\tDesc: $desc\n\n";
- print "\nSelect number: ";
- $SelectedService = <STDIN>;
- chomp $SelectedService;
- $SelectedService = $names[$SelectedService];
- }
- }
-} else {
+unless (scalar @services) {
print "No Services Matching Your Criteria were found.\n\nEXITING\n\n"; exit 0;
}
-my @wsdl = $Central->retrieveServiceByName([$SelectedService]);
-
-# the next line is ONLY for Mark's installation
-# because it runs off of my local machine
-# $wsdl[0] =~ s/bioinfo\.pbi\.nrc\.ca\:8099/192.168.1.9/g;
+my $x = 0;
+foreach (@services){
+
+ my ($name) = $_->name;
+ my ($type) = $_->type;
+ my $desc = $_->description;
+ my $auth = $_->authority;
+
+ print "\nFound Service #$x:\n".
+ "\tFrom: $auth\n".
+ "\tName: $name\n".
+ "\tType: $type\n".
+ "\tDesc: $desc\n\n";
+ ++$x;
+}
+
+print "\nSelect number: ";
+
+my $SelectedService = <STDIN>;
+chomp $SelectedService;
+my $SERVICE = $services[$SelectedService];
+
+my $wsdl = $Central->retrieveService(
+ authURI => $SERVICE->authority,
+ serviceName => $SERVICE->name,
+ );
# EXECUTE SELECTED SERVICE
-my $Service = MOBY::Client::Service->new(service => $wsdl[0]);
+my $Service = MOBY::Client::Service->new(service => $wsdl);
print "Executing Service: ",$Service->ServiceName,"\n";
my $data = SOAP::Data->type(base64 => "<Object namespace=\"$NS\" id=\"$ID\"/>");
my $result = $Service->execute($data);
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/Client/simple_client.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /tmp/T0lxaW9M 2003-01-28 16:51:46.120004100 -0500
+++ /tmp/T1mxaW9M 2003-01-28 16:51:46.130010326 -0500
@@ -3,12 +3,17 @@
use MOBY::Client::Central;
use MOBY::Client::Service;
-my $Central = MOBY::Client::Central->new(MOBY_server => "http://mobycentral.cbr.nrc.ca/cgi-bin/MOBY-Central.pl");
+my $Central = MOBY::Client::Central->new(
+ MOBY_server => "http://mobycentral.cbr.nrc.ca/cgi-bin/MOBY-Central.pl",
+ MOBY_uri => "http://mobycentral.cbr.nrc.ca/MOBY/Central",
+ );
print "looking for services that use Generic Keywords for retrieval\n";
# returns a list of ServiceInstance objects
-my @services = $Central->locateServiceByInput(['Object'], ['Generic/Keyword'], 'Retrieve');
+my @services = $Central->locateServiceByInput(
+ input => {'Object' =>['Generic/Keyword']},
+ serviceType => 'Retrieve');
foreach (@services) {
print "\nFound:\n",
@@ -18,7 +23,9 @@
"\tOutput: ",$_->output,"\n",
"\tDesc: ",$_->description,"\n\n";
- my $wsdl = $Central->retrieveService($_->authority, $_->name);
+ my $wsdl = $Central->retrieveService(
+ authURI => $_->authority,
+ serviceName => $_->name);
my $Service = MOBY::Client::Service->new(service => $wsdl);
print "Executing Service: ",$Service->ServiceName," with keywords '*brassinosteroid*' and '*apoptosis*'\n";
More information about the MOBY-guts
mailing list