[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at dev.open-bio.org
Thu Dec 14 18:10:40 UTC 2006


mwilkinson
Thu Dec 14 13:10:40 EST 2006
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory dev.open-bio.org:/tmp/cvs-serv15053/MOBY

Modified Files:
	Central.pm 
Log Message:
making initial code changes to support async potocol
moby-live/Perl/MOBY Central.pm,1.266,1.267
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.266
retrieving revision 1.267
diff -u -r1.266 -r1.267
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2006/12/14 17:57:05	1.266
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2006/12/14 18:10:40	1.267
@@ -3195,14 +3195,50 @@
 	# do substitutions
     my $serviceType = $SI->category;
     my $wsdl;
-    if ($serviceType eq "post"){
-		$wsdl = &_doPostWSDLReplacement(@_)
+	if ($serviceType eq "post"){
+	    $wsdl = &_doPostWSDLReplacement(@_)
 	} elsif ($serviceType eq "moby"){
-		$wsdl = &_doMobyWSDLReplacement(@_)
+	    $wsdl = &_doMobyWSDLReplacement(@_)
+	} elsif ($serviceType eq "moby-async"){
+	    $wsdl = &_doAsyncWSDLReplacement(@_)
 	}
 	return $wsdl;
 }
 
+sub _doAsyncWSDLReplacement {
+	# this routine does not work at the moment
+	# we're just waiting for an example of an async
+	# wsdl document from IMB
+	my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_;
+	my $wsdl = $WSDL_POST_TEMPLATE;
+	$wsdl =~ s/^\n//gs;
+	my $serviceName = $SI->servicename;
+	my $AuthURI     = $SI->authority_uri;
+	my $desc        = $SI->description;
+	if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
+		$desc = $1;
+	}
+	$desc =~ s"\<"&lt;"g;  # XMl encode now that it is not CDATAd
+	$desc =~ s"\>"&gt;"g;  # XML encode now that it is not CDATAd
+	my $URL    = $SI->url;
+    $URL =~ "(http://[^/]+)(/.*)";
+    my $baseURL = $1;
+	my $relativeURL = $2;
+	my $IN     = "NOT_YET_DEFINED_INPUTS";
+	my $OUT    = "NOT_YET_DEFINED_OUTPUTS";
+	my $INxsd  = &_getInputXSD( $InputXML, $SecondaryXML );
+	my $OUTxsd = &_getOutputXSD($OutputXML);
+	$INxsd  ||= "<NOT_YET_IMPLEMENTED_INPUT_XSD/>";
+	$OUTxsd ||= "<NOT_YET_IMPLEMENTED_OUTPUT_XSD/>";
+	$wsdl =~ s/MOBY__SERVICE__NAME__/$serviceName/g;    # replace all of the goofy portbindingpottype crap
+	$wsdl =~s/\<\!\-\-\s*MOBY__SERVICE__DESCRIPTION\s*\-\-\>/Authority: $AuthURI  -  $desc/g;    # add a sensible description
+	$wsdl =~ s/MOBY__SERVICE__URL/$baseURL/g;    # the URL to the service
+	$wsdl =~ s/MOBY__SERVICE__POST/$relativeURL/g;    # the URL to the service
+	$wsdl =~ s/MOBY__SERVICE__NAME/$serviceName/g;    # finally replace the actual subroutine call
+	return $wsdl;
+}
+
+
 sub _doPostWSDLReplacement {
 	my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_;
 	my $wsdl = $WSDL_POST_TEMPLATE;
@@ -3233,6 +3269,7 @@
 	return $wsdl;
 }
 
+
 sub _doMobyWSDLReplacement {
 	my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_;
 	my $wsdl = $WSDL_TEMPLATE;
@@ -3781,6 +3818,131 @@
 ##
 ##
 
+=head2 _getInputXSD
+
+  name    : _getInputXSD($InputXML, $SecondaryXML)
+  function: to get an XSD describing the input to a MOBY Service,
+            e.g. to use in a WSDL document
+  args    : (see _serviceListResponse code above for full details of XML)
+           $InputXML - the <Input>...</Input> block of a findService
+           response message
+           
+           $SecondaryXML - the <secondaryArticles>...<sescondaryArticles>
+           fragment of a findService response message
+           
+  returns :  XSD fragment of XML (should not return an XML header!)
+  notes   : the structure of an Input block is as follows:
+           <Input>
+              <!-- one or more Simple or Collection articles -->
+           </Input>
+           
+           the structure of a secondaryArticle block is as follows:
+           <sescondaryArticles>
+              <!-- one or more Parameter blocks -->
+           </secondaryArticles>
+           
+
+=over
+
+=item *  Simple
+
+         <Simple articleName="NameOfArticle">
+           <objectType>ObjectOntologyTerm</objectType>
+           <Namespace>NamespaceTerm</Namespace>
+           <Namespace>...</Namespace><!-- one or more... -->
+         </Simple>
+
+=item *  Collection note that articleName of the contained Simple objects is not required, and is ignored.
+
+        
+         <Collection articleName="NameOfArticle">
+            <Simple>......</Simple> <!-- Simple parameter type structure -->
+            <Simple>......</Simple> <!-- DIFFERENT Simple parameter type
+                                      (used only when multiple Object Classes
+                                      appear in a collection) -->
+         </Collection>
+
+=item *  Secondary
+
+        
+          <Parameter articleName="NameOfArticle">
+                <datatype>INT|FLOAT|STRING</datatype>
+                <default>...</default> <!-- any/all of these -->
+                <max>...</max>         <!-- ... -->
+                <min>...</min>         <!-- ... -->
+                <enum>...<enum>        <!-- ... -->
+                <enum>...<enum>        <!-- ... -->
+          </Parameter>
+
+=back
+
+=cut
+
+sub _getInputXSD {
+	my ( $Input, $Secondary ) = @_;
+	my $XSD;
+	return $XSD;
+}
+
+=head2 _getOuputXSD
+
+  name    : _getOutputXSD($OutputXML)
+  function: to get an XSD describing the output from a MOBY Service
+            e.g. to use in a WSDL document
+  args    : (see _serviceListResponse code above for full details)
+           $InputXML - the <Input>...</Input> block of a findService
+           response message
+           
+           $SecondaryXML - the <secondaryArticles>...<sescondaryArticles>
+           fragment of a findService response message
+           
+  returns :  XSD fragment of XML (should not return an XML header!)
+  notes   : the structure of an Output block is as follows:
+           <Input>
+              <!-- one or more Simple or Collection articles -->
+           </Input>
+
+=over
+
+=item *  Simple
+
+         <Simple articleName="NameOfArticle">
+           <objectType>ObjectOntologyTerm</objectType>
+           <Namespace>NamespaceTerm</Namespace>
+           <Namespace>...</Namespace><!-- one or more... -->
+         </Simple>
+
+=item *  Collection note that articleName of the contained Simple objects is not required, and is ignored.
+
+        
+         <Collection articleName="NameOfArticle">
+            <Simple>......</Simple> <!-- Simple parameter type structure -->
+            <Simple>......</Simple> <!-- DIFFERENT Simple parameter type
+                                      (used only when multiple Object Classes
+                                       appear in a collection) -->
+         </Collection>
+
+=back
+
+=cut
+
+sub _getOutputXSD {
+	my ($Output) = @_;
+	my $XSD;
+	return $XSD;
+}
+
+
+
+=head2 WSDL_Templates
+
+=cut
+
+#===============================================
+#===============================================
+#===============================================
+
+# Standard MOBY WSDL Template
 
 $WSDL_TEMPLATE = <<END;
 <?xml version="1.0"?>
@@ -3835,6 +3997,7 @@
 END
 
 
+# MOBY POST service template
 
 $WSDL_POST_TEMPLATE = <<END2;
 <?xml version="1.0"?>
@@ -3890,119 +4053,62 @@
 END2
 
 
-=head2 _getInputXSD
-
-  name    : _getInputXSD($InputXML, $SecondaryXML)
-  function: to get an XSD describing the input to a MOBY Service,
-            e.g. to use in a WSDL document
-  args    : (see _serviceListResponse code above for full details of XML)
-           $InputXML - the <Input>...</Input> block of a findService
-           response message
-           
-           $SecondaryXML - the <secondaryArticles>...<sescondaryArticles>
-           fragment of a findService response message
-           
-  returns :  XSD fragment of XML (should not return an XML header!)
-  notes   : the structure of an Input block is as follows:
-           <Input>
-              <!-- one or more Simple or Collection articles -->
-           </Input>
-           
-           the structure of a secondaryArticle block is as follows:
-           <sescondaryArticles>
-              <!-- one or more Parameter blocks -->
-           </secondaryArticles>
-           
-
-=over
-
-=item *  Simple
+# for MOBY Asynchronous services.  This WSDL is not correct YET!
 
-         <Simple articleName="NameOfArticle">
-           <objectType>ObjectOntologyTerm</objectType>
-           <Namespace>NamespaceTerm</Namespace>
-           <Namespace>...</Namespace><!-- one or more... -->
-         </Simple>
-
-=item *  Collection note that articleName of the contained Simple objects is not required, and is ignored.
-
-        
-         <Collection articleName="NameOfArticle">
-            <Simple>......</Simple> <!-- Simple parameter type structure -->
-            <Simple>......</Simple> <!-- DIFFERENT Simple parameter type
-                                      (used only when multiple Object Classes
-                                      appear in a collection) -->
-         </Collection>
-
-=item *  Secondary
+$WSDL_ASYNC_TEMPLATE = <<END;
+<?xml version="1.0"?>
+<wsdl:definitions name="MOBY_Central_Generated_WSDL"
+                targetNamespace="http://biomoby.org/Central.wsdl"
+                xmlns:tns="http://biomoby.org/Central.wsdl"
+                xmlns:xsd1="http://biomoby.org/CentralXSDs.xsd" 
+                xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+                xmlns:xsd="http://www.w3.org/1999/XMLSchema"
+                xmlns="http://schemas.xmlsoap.org/wsdl/"
+                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
 
+  
+  <wsdl:message name="MOBY__SERVICE__NAME__Input">
+          <wsdl:part name="data" type="xsd:string"/>
+  </wsdl:message>
         
-          <Parameter articleName="NameOfArticle">
-                <datatype>INT|FLOAT|STRING</datatype>
-                <default>...</default> <!-- any/all of these -->
-                <max>...</max>         <!-- ... -->
-                <min>...</min>         <!-- ... -->
-                <enum>...<enum>        <!-- ... -->
-                <enum>...<enum>        <!-- ... -->
-          </Parameter>
-
-=back
-
-=cut
-
-sub _getInputXSD {
-	my ( $Input, $Secondary ) = @_;
-	my $XSD;
-	return $XSD;
-}
-
-=head2 _getOuputXSD
-
-  name    : _getOutputXSD($OutputXML)
-  function: to get an XSD describing the output from a MOBY Service
-            e.g. to use in a WSDL document
-  args    : (see _serviceListResponse code above for full details)
-           $InputXML - the <Input>...</Input> block of a findService
-           response message
-           
-           $SecondaryXML - the <secondaryArticles>...<sescondaryArticles>
-           fragment of a findService response message
-           
-  returns :  XSD fragment of XML (should not return an XML header!)
-  notes   : the structure of an Output block is as follows:
-           <Input>
-              <!-- one or more Simple or Collection articles -->
-           </Input>
-
-=over
-
-=item *  Simple
+  <wsdl:message name="MOBY__SERVICE__NAME__Output">
+          <wsdl:part name="body" type="xsd:string"/>
+  </wsdl:message>
+          
+  <wsdl:portType name="MOBY__SERVICE__NAME__PortType">
+          <wsdl:operation name="MOBY__SERVICE__NAME">
+                 <wsdl:input message="tns:MOBY__SERVICE__NAME__Input"/>
+                 <wsdl:output message="tns:MOBY__SERVICE__NAME__Output"/>
+          </wsdl:operation>
+  </wsdl:portType>
+ 
+  <wsdl:binding name="MOBY__SERVICE__NAME__Binding" type="tns:MOBY__SERVICE__NAME__PortType">
+          <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+          <wsdl:operation name="MOBY__SERVICE__NAME"><!-- in essense, this is the name of the subroutine that is called -->
+                 <soap:operation soapAction='http://biomoby.org/#MOBY__SERVICE__NAME' style='rpc'/>
+                 <wsdl:input>
+                         <soap:body use="encoded" namespace="http://biomoby.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+                 </wsdl:input>
+                 <wsdl:output>
+                         <soap:body use="encoded"/>
+                 </wsdl:output>
+          </wsdl:operation>
+  </wsdl:binding>
+                
+  <wsdl:service name="MOBY__SERVICE__NAME__Service">
+          <wsdl:documentation><!-- MOBY__SERVICE__DESCRIPTION --></wsdl:documentation>  <!-- service description goes here -->
+          <wsdl:port name="MOBY__SERVICE__NAME__Port" binding="tns:MOBY__SERVICE__NAME__Binding">
+                 <soap:address location="MOBY__SERVICE__URL"/>    <!-- URL to service scriptname -->
+          </wsdl:port>
+  </wsdl:service>
 
-         <Simple articleName="NameOfArticle">
-           <objectType>ObjectOntologyTerm</objectType>
-           <Namespace>NamespaceTerm</Namespace>
-           <Namespace>...</Namespace><!-- one or more... -->
-         </Simple>
+</wsdl:definitions>
 
-=item *  Collection note that articleName of the contained Simple objects is not required, and is ignored.
 
-        
-         <Collection articleName="NameOfArticle">
-            <Simple>......</Simple> <!-- Simple parameter type structure -->
-            <Simple>......</Simple> <!-- DIFFERENT Simple parameter type
-                                      (used only when multiple Object Classes
-                                       appear in a collection) -->
-         </Collection>
+END
 
-=back
 
-=cut
 
-sub _getOutputXSD {
-	my ($Output) = @_;
-	my $XSD;
-	return $XSD;
-}
 
 1;
 




More information about the MOBY-guts mailing list