[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Thu Apr 1 21:23:48 UTC 2004


mwilkinson
Thu Apr  1 16:23:47 EST 2004
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv7213/MOBY/Client

Modified Files:
	Service.html Service.pm 
Log Message:
update the execute method to allow multiple inputs to a single invocation.  Documentation updated.  Fixed bug of articleName attribute being attached to the wrong XML element

moby-live/Perl/MOBY/Client Service.html,1.3,1.4 Service.pm,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html	2003/08/06 14:31:21	1.3
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.html	2004/04/01 21:23:47	1.4
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>MOBY::Client::Service - an object for communicating with MOBY Services</title>
-<link rev="made" href="mailto:markw at illuminae.(none)" />
+<link rev="made" href="mailto:markw at illuminae.com" />
 </head>
 
 <body style="background-color: white">
@@ -95,12 +95,21 @@
                 input is named &quot;object1&quot; in both cases.
                 
                 $Service-&gt;execute(XMLinputlist =&gt; [
-                                 ['collection1', [
+                                 ['', [
                                      '&lt;Object namespace=&quot;blah&quot; id=&quot;123&quot;/&gt;',
                                      '&lt;Object namespace=&quot;blah&quot; id=&quot;234&quot;/&gt;']
                               ]);
                 This would invoke the service once with a collection of sequence inputs
-                called &quot;collection1&quot;</pre>
+                that are not required to be named ('')</pre>
+<pre>
+                $Service-&gt;execute(XMLinputlist =&gt; [
+                                 [
+                             'input1', '&lt;Object namespace=&quot;blah&quot; id=&quot;123&quot;/&gt;',
+                             'input2', '&lt;Object namespace=&quot;blah&quot; id=&quot;234&quot;/&gt;',
+                             ]
+                              ]);
+                This would cause a single invocation of a service requiring
+                two input parameters named &quot;input1&quot; and &quot;input2&quot;</pre>
 <p>
 </p>
 <h2><a name="servicename">ServiceName</a></h2>

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm	2004/01/05 21:29:08	1.7
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm	2004/04/01 21:23:47	1.8
@@ -165,12 +165,21 @@
                 input is named "object1" in both cases.
                 
                 $Service->execute(XMLinputlist => [
-	                         ['collection1', [
+	                         ['', [
                                      '<Object namespace="blah" id="123"/>',
                                      '<Object namespace="blah" id="234"/>']
                               ]);
                 This would invoke the service once with a collection of sequence inputs
-                called "collection1"
+                that are not required to be named ('')
+
+                $Service->execute(XMLinputlist => [
+	                         [
+                             'input1', '<Object namespace="blah" id="123"/>',
+                             'input2', '<Object namespace="blah" id="234"/>',
+                             ]
+                              ]);
+                This would cause a single invocation of a service requiring
+                two input parameters named "input1" and "input2" 
 
 
 =cut
@@ -183,20 +192,25 @@
 	my $data;	
 	foreach (@inputs){
 		return "ERROR:  expected listref [articleName, XML] for data element" unless (ref($_) =~ /array/i); 
-		my ($articleName, $XML) = @{$_};
 		my $qID = $self->_nextQueryID;
-		if (!(ref($XML)=~/array/i)){
-			$articleName ||="";
-			$XML ||= "";
-			$data .= "<moby:queryInput moby:articleName='$articleName' queryID='$qID'><moby:Simple>\n$XML\n</moby:Simple></moby:queryInput>\n";
-		} elsif (ref($XML)=~/array/i){
-			my @objs = @{$XML};
-			$data .="<moby:queryInput moby:articleName='$articleName' queryID='$qID'><moby:Collection>\n";
-			foreach (@objs){
-				$data .= "$_\n";
-			}
-			$data .="</moby:Collection>\n</moby:queryInput>\n"
-		}
+        $data .= "<moby:queryInput queryID='$qID'>";
+		while (my ($articleName, $XML) = splice (@{$_}, 0, 2)){
+            if (!(ref($XML)=~/array/i)){
+                $articleName ||="";
+                $XML ||= "";
+                $data .= "<moby:Simple moby:articleName='$articleName'>\n$XML\n</moby:Simple>\n";
+                
+            # need to do this for collections also!!!!!!    
+            } elsif (ref($XML)=~/array/i){
+                my @objs = @{$XML};
+                $data .="<moby:queryInput queryID='$qID'><moby:Collection moby:articleName='$articleName'>\n";
+                foreach (@objs){
+                    $data .= "$_\n";
+                }
+                $data .="</moby:Collection>\n";
+            }
+        }
+        $data .="</moby:queryInput>\n";
 	}
 	$data = "<![CDATA[<?xml version='1.0' encoding='UTF-8'?>
 	<moby:MOBY xmlns:moby='http://www.biomoby.org/moby-s'>




More information about the MOBY-guts mailing list