[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Fri Feb 21 00:15:44 UTC 2003


mwilkinson
Thu Feb 20 19:15:44 EST 2003
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv26952/Perl/MOBY/Client

Modified Files:
	Central.pm ServiceInstance.pm 
Log Message:
implemented GOOBY :-)  MOBY-Central is now able to register CGI services, and provide you with a URL and a GET string in sprintf format ready for you to pass parameters to.  This is trez cool :-)  I will commit a sample GOOBY client script in a minute and will register a few CGI services for you to GOOBY for yourself.
moby-live/Perl/MOBY/Client Central.pm,1.2,1.3 ServiceInstance.pm,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/02/20 02:23:33	1.2
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/02/21 00:15:44	1.3
@@ -95,7 +95,7 @@
 
 =cut
 
-my $debug = 0;
+my $debug = 1;
 
 if ($debug){open (OUT, ">/tmp/CentralLogOut.txt") || die "cant open logfile CentralLogOut.txt $!\n";close OUT;}
 
@@ -462,82 +462,71 @@
 
 =cut
 
-# inputXML (FOR CGI GET SERVICES):
-# <registerService>
-#  <Category>cgi</Category>
-#  <serviceName>YourServiceNameHere</serviceName>
-#  <serviceType>YourServiceTypeHere</serviceType>
-#  <authURI>your.URI.here</authURI>
-#  <URL>http://URL.to.your/CGI.pl</URL>
-#  <inputObjects>
-#	  <Input>
-#		sprintf string of your GET line
-#	  </Input>
-#  </inputObjects>
-#  <Description><![CDATA[
-#	  human readable description of your service]]>
-#  </Description>
-# </registerService>
-#
-# inputXML (FOR non-MOBY SOAP SERVICES):
-# <registerService>
-#  <Category>soap</Category>
-#  <serviceName>YourServiceNameHere</serviceName>
-#  <serviceType>YourServiceTypeHere</serviceType>
-#  <authURI>your.URI.here</authURI>
-#  <URL>http://URL.to.your/definition.wsdl</URL>
-#  <Description><![CDATA[
-#	  human readable description of your service]]>
-#  </Description>
-# </registerService>
-#
-
 sub registerService {
 
 	my ($self, %a) = @_;
 	return $self->errorRegXML("Function not allowed when querying multiple registries") if $self->multiple_registries;
 	my $name = $a{serviceName}; $name ||="";
 	my $type = $a{serviceType}; $type ||="";
-	my %IN = %{$a{input}}; 
-	my @OUT = @{$a{output}};
 	my $authURI = $a{authURI}; $authURI ||="";
 	my $URL = $a{URL}; $URL ||="";
 	my $desc = $a{description}; $desc ||="";
 	my $Category = $a{Category}; $Category ||="";
 
-	
 	my $message = "
 		<registerService>
 			<Category>$Category</Category>
 			<serviceName>$name</serviceName>
 			<serviceType>$type</serviceType>
 			<Description><![CDATA[$desc]]></Description>
-			<inputObjects>\n";
-	while (my ($otype, $ns) = each %IN){
-		$message .= "
-		    <Input>
-				<objectType>$otype</objectType>\n";
-		foreach (@{$ns}){		
+			<URL>$URL</URL>
+			<authURI>$authURI</authURI>";
+
+	if ($Category eq "moby") {
+			my %IN = %{$a{input}}; 
+			my @OUT = @{$a{output}};
+			$message .= "<inputObjects>\n";
+			while (my ($otype, $ns) = each %IN){
+				$message .= "
+					<Input>
+						<objectType>$otype</objectType>\n";
+				foreach (@{$ns}){		
+					$message .= "
+						<Namespace>$_</Namespace>\n"
+				}
+				$message .= "
+				   </Input>\n";
+			}
+			
+			$message .="
+					</inputObjects>
+					<outputObjects>";
+					
+			foreach (@OUT){
+				$message .= "
+						<objectType>$_</objectType>\n";
+			}
+			$message .="
+					</outputObjects>
+				</registerService>";
+	} elsif ($Category eq "cgi") {
+			my $IN = $a{input}; 
 			$message .= "
-				<Namespace>$_</Namespace>\n"
-		}
-		$message .= "
-		   </Input>\n";
-	}
-	
-	$message .="
+			<inputObjects>
+				<Input><![CDATA[$IN]]></Input>
 			</inputObjects>
-			<outputObjects>";
-			
-	foreach (@OUT){
-		$message .= "
-			    <objectType>$_</objectType>\n";
-	}
-	$message .="
-			</outputObjects>
-			<authURI>$authURI</authURI>
-			<URL>$URL</URL>
 		</registerService>";
+	} else {
+			$message .= "
+		</registerService>";
+	}
+
+
+	#unless ($message =~ /\<\/registerService/){ return MOBY::Registration->new(
+	#	success => "0",
+	#	error_messsage => "missing parameters or other failure leading to incorrectly formatted XML",
+	#	registration_id => "0")};
+
 	$debug && &_LOG(" message\n\n$message\n\n");
 	my $return = $self->SOAP_connection->call(registerService => ($message))->paramsall;
 
@@ -605,10 +594,49 @@
 
 
 
+=head2 locateServiceByKeywords
+
+ Title     :	locateServiceByKeywords
+ Usage     :	@Services = $MOBY->locateServiceByKeywords(%args)
+ Function  :	get the names/descriptions for services that use certain INPUT's
+ Returns   :	list of ServiceInstance objects
+ Args      :    keywords    => \@keyword_list
+
+=cut
+
+
+
+sub locateServiceByKeywords {
+
+	my ($self, %a) = @_;
+	my $kw = $a{keywords};
+	return () unless scalar @{$kw};
+
+	my $message = "
+		<locateServiceByKeywords>\n";
+
+	foreach (@{$kw}){
+		$message .= "<keyword>$_</keyword>\n";
+	}
+	$message .="</locateServiceByKeywords>\n";
+	
+	########  NEED TO PASS REG NAME TO _parseServices
+	my $return; my @Services;
+	foreach my $server(@{$self->SOAP_connections}){
+		my ($name, $conn) = @{$server};
+		$return .= $conn->call(locateServiceByKeywords => ($message))->paramsall;
+		push @Services, $self->_parseServices($name, $return);
+    }
+    return @Services;
+
+}
+
+
+
 =head2 locateServiceByOutput
 
  Title     :	locateServiceByOutput
- Usage     :	@Services = $MOBY->locateServiceByOutput(@args)
+ Usage     :	@Services = $MOBY->locateServiceByOutput(%args)
  Function  :	get the names/descriptions for services that use certain INPUT's
  Returns   :	list of ServiceInstance objects
  Args      :	(in order)
@@ -760,7 +788,7 @@
 =head2 retrieveService
 
  Title     :	retrieveService
- Usage     :	$WSDL = $MOBY->locateService(%args)
+ Usage     :	$WSDL = $MOBY->retrieveService(%args)
  Function  :	get the WSDL definition of the service with this name/authority URI
  Returns   :	a WSDL string
  Args      :	authURI		=> $AuthURI,
@@ -792,11 +820,22 @@
     my $return  = $self->SOAP_connection($reg)->call(retrieveService => ($message))->paramsall;
     my $parser = new XML::DOM::Parser;
     my $doc = $parser->parse($return);
-    my $WSDL = $doc->getDocumentElement->getFirstChild->getNodeValue;
-    $WSDL =~ s/^\n//gs;
-    #&_LOG("WSDL__________________\n$WSDL\n_____________________\n");    
-    return $WSDL;
-    
+	
+    my $de = $doc->getDocumentElement;
+	my @child = $de->getChildNodes;
+    my $content;
+    foreach (@child){
+        $debug && &_LOG($_->getNodeTypeName, "\t", $_->toString,"\n");
+        if ($_->getNodeType == TEXT_NODE) {
+			$content .= $_->getNodeValue;
+		} else {
+	        $content .= $_->toString;
+		}
+    }
+
+    $content =~ s/^\n//gs;
+    return $content;
+
 }
 
 
@@ -1037,10 +1076,13 @@
         my $Type = &_nodeTextContent($Service, 'serviceType');
         my $Output = &_nodeTextContent($Service, 'outputObject');
         my $Description = &_nodeTextContent($Service, 'Description');
+        my $cat = &_nodeTextContent($Service, 'Catagory');
+		
         my $Instance = MOBY::Client::ServiceInstance->new(
             authority => $AuthURI,
             name => $servicename,
             type => $Type,
+            catagory => $cat,
             output => $Output,
             description => $Description,
 			registry	=> $Registry,

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.pm	2003/02/19 23:09:25	1.1
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/ServiceInstance.pm	2003/02/21 00:15:44	1.2
@@ -20,6 +20,7 @@
      authority => 'bioinfo.pbi.nrc.ca',
      name => 'marksFabulousService',
      type => 'Retrieve',
+	 catagory => 'moby',
      output => 'Sequence',
      description => 'retrieves random sequences from a database');
 
@@ -132,6 +133,7 @@
                       name          => [undef,      'read/write'],
                       type          => [undef,      'read/write'],
                       output        => [undef,      'read/write'],
+                      catagory      => [undef,      'read/write'],
                       description   => [undef,      'read/write'],
 					  registry		=> ['MOBY_Central', 		'read/write'],
 				);



More information about the MOBY-guts mailing list