[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Fri May 9 13:06:24 UTC 2003
mwilkinson
Fri May 9 09:06:24 EDT 2003
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv7071/Perl/MOBY/Client
Modified Files:
Central.pm
Log Message:
wrapped findService in the Client::Central wrapper
moby-live/Perl/MOBY/Client Central.pm,1.22,1.23
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/05/08 18:30:27 1.22
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/05/09 13:06:24 1.23
@@ -726,6 +726,7 @@
+
=head2 deregisterService
Title : deregisterService
@@ -763,6 +764,113 @@
+=head2 findService
+
+ Title : findService
+ Usage : $REG = $MOBY->findService(%args)
+ Function : deregister a registered MOBY Service
+ Returns : MOBY::Registration object
+ Args :
+ serviceName => $serviceName,
+ serviceType => $serviceType,
+ authURI => $authURI,
+ authoritative => 1,
+ category => "moby" | "cgi" | "soap" (currently only moby supported)
+ expandObjects => 1,
+ expandServices => 1,
+ URL => $U'RL_TO_SERVICE
+ keywords => [kw1, kw2, kw3]
+
+ input =>{
+ articleName1 => [objType1 => [ns1, ns2...]], # Simple
+ articleName2 => [[objType2 => [ns3, ns4...]]], # collection of one object type
+ articleName3 => [[objType3 => [ns3, ns4...]], [objType4 => [ns5, ns6]]], # collection of multiple object types
+ }
+
+
+ output =>{
+ articleName1 => [objType1 => [ns1, ns2...]], # Simple
+ articleName2 => [[objType2 => [ns3, ns4...]]], # collection of one object type
+ articleName3 => [[objType3 => [ns3, ns4...]], [objType4 => [ns5, ns6]]], # collection of multiple object types
+ }
+
+=cut
+
+sub findService {
+
+ my ($self, %a) = @_;
+ my $id = $a{'serviceID'};
+ my $servicename = $a{'servicename'}; $servicename |="";
+ my $authoritative = $a{'authoritative'}; $authoritative |= 0;
+ my $serviceType = $a{'serviceType'}; $serviceType |= "";
+ my $authURI = $a{'authURI'}; $authURI |="";
+ my $category = $a{'category'}; $category |= "moby" ;
+ my $exObj = $a{'expandObjects'}; $exObj |=0;
+ my $exServ = $a{'expandServices'}; $exServ |= 0;
+ my $kw = $a{'keywords'};
+ ref($kw) =~ /array/i || return $self->errorRegXML("invalid structure of keywords. Expected arrayref");
+ my @kw = @{$kw};
+
+ my $message = "<findService>
+<authoritative>$authoritative</authoritative>
+<Category>$category</Category>
+<serviceType>$serviceType</serviceType>
+<serviceName>$servicename</serviceName>
+<authURI>$authURI</authURI>;
+<expandObjects>$exObj</expandObjects>
+<expandServices>$exServ</expandServices>
+<keywords>\n";
+ foreach (@kw){
+ $message .="<keyword>$kw</keyword>\n";
+ }
+ $message .="</keywords>\n";
+
+ my %IN = %{$a{input}};
+ my %OUT = %{$a{output}};
+ my %funkyhash = ( Input => \%IN, Output => \%OUT);
+ while (my ($inout, $param) = each %funkyhash){
+ my $inout_lc = lc ($inout);
+ my %PARAM = %{$param};
+ $message .= "<${inout_lc}Objects><${inout}>\n";
+ while (my ($articleName, $def) = each %PARAM){
+ my @Objects; #
+ unless (ref($def) =~ /array/i){return $self->errorRegXML("invalid structure of $inout objects, expected arrayref for article $articleName")}
+ my @objectdefs;
+ if ((ref $def->[0]) =~ /array/i){ # collection
+ # def= [[objType2 => [ns3, ns4...]], ...]
+ $message .="<Collection>\n";
+ @objectdefs = @{$def};
+ } else { # Nipple
+ @objectdefs = ($def);
+ # def = [objType1 => [ns1, ns2...]],
+ }
+
+ foreach my $objectdef(@objectdefs){
+ $message .="<Simple articleName='$articleName'>\n";
+ my ($type, $Namespaces) = @{$objectdef};
+ $message .="<objectType>$type</objectType>\n";
+ unless (ref($Namespaces) =~ /array/i){return $self->errorRegXML("invalid structure of $inout namespaces for object $type in article $articleName; expected arrayref")}
+ foreach my $ns(@{$Namespaces}){
+ $message .="<Namespace>$ns</Namespace>\n";
+ }
+ $message .="</Simple>\n";
+ }
+ if ((ref($def->[0])) =~ /array/i){
+ $message .="</Collection>\n";
+ }
+ }
+ $message .= "</${inout}></${inout_lc}Objects>\n";
+ }
+ $message .= "</findService>\n";
+
+ my $return = $self->SOAP_connection->call(findService => ($message))->paramsall;
+ return ($self->parseRegXML($return));
+
+}
+
+
+
+
=head2 locateServiceByKeywords
More information about the MOBY-guts
mailing list