[Pywps-commits] r1129 - in branches/pywps-3.2-soap/pywps: . Wps XSLT

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 22 09:52:32 CET 2011


Author: jesus
Date: 2011-02-22 09:52:31 +0100 (Tue, 22 Feb 2011)
New Revision: 1129

Modified:
   branches/pywps-3.2-soap/pywps/Soap.py
   branches/pywps-3.2-soap/pywps/Wps/Wsdl.py
   branches/pywps-3.2-soap/pywps/XSLT/SOAP2WPS.xsl
   branches/pywps-3.2-soap/pywps/XSLT/WPS2SOAP.xsl
   branches/pywps-3.2-soap/pywps/XSLT/describeProcess2WSDL.xsl
Log:
correct convertion between identifier string and elementName (startChar problem in XML)

Modified: branches/pywps-3.2-soap/pywps/Soap.py
===================================================================
--- branches/pywps-3.2-soap/pywps/Soap.py	2011-02-11 16:51:29 UTC (rev 1128)
+++ branches/pywps-3.2-soap/pywps/Soap.py	2011-02-22 08:52:31 UTC (rev 1129)
@@ -45,6 +45,29 @@
 import types
 import re
 
+########### START OF XSLT FUNCTIONS ##################
+def getCorrectInputID(dummy,identifier):
+	"""XSLT function that converts the I/O identifier into a correct process I/O identifier. This is necessary
+	to deal with cases like <ows:Identifier>--flag<ows:Identifier> that get converted into <flag> elements, in the WSDL description. 
+	Function will do a reverse mapping"""
+	
+	correctInput=[input for input in inputKeys if input.find(identifier)>-1][0]
+	return correctInput
+
+# http://www.w3.org/TR/REC-xml/#charsets (only ":" | [A-Z] | "_" | [a-z])
+regExp=re.compile(r"[^a-zA-Z_:]*") 
+def flagRemover(dummy,strXML):
+    """Remove any char that is not allowed as Element name only (":" | [A-Z] | "_" | [a-z]) allowed as start char. Same function as describeProcess2WSDL"""
+    endN=regExp.match(strXML).end()
+    return strXML[endN:]
+
+
+ns=etree.FunctionNamespace("http://pywps.wald.intevation.org/functions")
+ns.prefix='fn'
+ns["getCorrectInputID"]=getCorrectInputID
+ns["flagRemover"]=flagRemover
+########### END OF XSLT FUNCTIONS ##################
+
 #For soap 1.2 -->http://www.w3.org/2003/05/soap-envelope (self.nsIndex=0)
 #For soap 1.1 -->http://schemas.xmlsoap.org/soap/envelope/ (self.nsIndex=1)
 soap_env_NS = ["http://www.w3.org/2003/05/soap-envelope","http://schemas.xmlsoap.org/soap/envelope/"]
@@ -82,8 +105,8 @@
 
 
 soap = False
+inputKeys=None #filled in SOAP2WPS and then used by getCorrectInputID
 
-
 def isSoap(document): 
     global soap
     
@@ -111,22 +134,43 @@
     #The solution is a tiny hack the XSL file, the WPS/OWS namespace are different from the ComplexInput, something like this: http://REPLACEME/wps/1.0.0
     #When etree is printed the REPLACEME is subtituted by www.opengis.net, creating the correct namespaces for the DOM parsing.
     #The replace is done using module re and set that it has to do only 2 replaces in the beggining. Therefore the replace is independe of the since of XML content
-     
+    global inputKeys
+    
+    processID=tree.tag.rsplit("_",1)[-1]
+    wps2=pywps.Pywps()
+    wps2.inputs={'request': 'getCapabilities', 'version': '1.0.0', 'service': 'wps'}
+    from pywps.Wps import Request
+    request=Request(wps2)
+    process=[process for process in request.processes if process.identifier in [processID]][0]
+    #These global variables will be used getCorrectInputID()
+    inputKeys=process.inputs.keys()
+    #outputKeys=process.outputs.keys()
+    
+    #processIDInputs=
+    #ns=etree.FunctionNamespace("http://pywps.wald.intevation.org/functions")
+    #ns.prefix='fn'
+    #ns["getCorrectInputID"]=getCorrectInputID
+    
+   # {http://www.opengis.net/wps/1.0.0}ExecuteProcess_gdalinfo
+    
     XSLTDocIO=open(pywps.XSLT.__path__[0]+"/SOAP2WPS.xsl","r")
    
     XSLTDoc=etree.parse(XSLTDocIO)
    
     transformer=etree.XSLT(XSLTDoc)
     WPSTree = transformer(tree)
-    
     etree.cleanup_namespaces(WPSTree)
     
     XMLOut=etree.tostring(WPSTree)
-   
+    
     XMLOut=re.sub(r'REPLACEME',"www.opengis.net",XMLOut,2)
-   
+
+    
     return XMLOut
 
+
+	
+
 def WPStoSOAP(tree):
 	
 	
@@ -142,7 +186,7 @@
     	#Just dump the OGC exception
     	return etree.tostring(exceptionElementList[0])
    
-    
+     
 
     XSLTDoc =etree.parse(XSLTDocIO)
     transformer=etree.XSLT(XSLTDoc)
@@ -265,7 +309,6 @@
              #General WPS:
            #print reqWPS[0].tag #getting the element's name
                 if "ExecuteProcess" in reqWPS[0].tag:
-                   
                    XMLStr=SOAPtoWPS(reqWPS[0])
                    XMLDoc=minidom.parseString(XMLStr)
             	  

Modified: branches/pywps-3.2-soap/pywps/Wps/Wsdl.py
===================================================================
--- branches/pywps-3.2-soap/pywps/Wps/Wsdl.py	2011-02-11 16:51:29 UTC (rev 1128)
+++ branches/pywps-3.2-soap/pywps/Wps/Wsdl.py	2011-02-22 08:52:31 UTC (rev 1129)
@@ -33,8 +33,24 @@
 import StringIO
 import re
 
+########### START OF XSLT FUNCTIONS ##################
 
 
+# http://www.w3.org/TR/REC-xml/#charsets (only ":" | [A-Z] | "_" | [a-z])
+regExp=re.compile(r"[^a-zA-Z_:]*") 
+def flagRemover(dummy,strXML):
+    """Function called from describeProcess2WSDL.xsl and necessary
+    to remove any char that is not allowed as Element name only (":" | [A-Z] | "_" | [a-z]) allowed as start char"""
+    endN=regExp.match(strXML).end()
+    return strXML[endN:]
+
+#Registering necessary etree functions
+ns=etree.FunctionNamespace("http://pywps.wald.intevation.org/functions")
+ns.prefix='fn'
+ns["flagRemover"]=flagRemover
+
+########### END OF XSLT FUNCTIONS ##################
+
 class Wsdl(Request):
     """
     """
@@ -46,7 +62,6 @@
            wps   - parent WPS instance
         """
         Request.__init__(self,wps)
-
         #
         # global variables
         #
@@ -54,14 +69,18 @@
         #self.templateProcessor.set("name",name)
         #self.templateProcessor.set("address",config.getConfigValue("wps","serveraddress"))
         
+        
+        
         serverURL=config.getConfigValue("wps","serveraddress")
-   
+        
         #Generating a describeProcess for all processes
         wps2=pywps.Pywps()
         wps2.inputs={'identifier': ['all'], 'version': '1.0.0', 'request': 'describeprocess', 'language': 'eng', 'service': 'wps'}
         requestDescribeProcess=DescribeProcess(wps2)
         describeProcessXML=requestDescribeProcess.response
         
+        
+        
         #Transforming the describeProcessXML into WSDL document
         describeProcess2WSDLXSL=open(pywps.XSLT.__path__[0]+"/describeProcess2WSDL.xsl","r")
         transformerXSLT=etree.XSLT(etree.parse(describeProcess2WSDLXSL))

Modified: branches/pywps-3.2-soap/pywps/XSLT/SOAP2WPS.xsl
===================================================================
--- branches/pywps-3.2-soap/pywps/XSLT/SOAP2WPS.xsl	2011-02-11 16:51:29 UTC (rev 1128)
+++ branches/pywps-3.2-soap/pywps/XSLT/SOAP2WPS.xsl	2011-02-22 08:52:31 UTC (rev 1129)
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1">
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" 
+xmlns:wps="http://www.opengis.net/wps/1.0.0" 
+xmlns:ows="http://www.opengis.net/ows/1.1"
+xmlns:fn="http://pywps.wald.intevation.org/functions">
   <xsl:template match="/">
     <!-- Determine the Execute process id -->
     <!-- It gets the root element and passed the string after ExecuteProcess-->
@@ -15,10 +18,10 @@
     <!-- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  -->
     <!-- xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd" -->
     <!--  -->
-    
+
     <!-- Execute element -->
     <xsl:element name="Execute" namespace="http://www.opengis.net/wps/1.0.0">
-     <xsl:copy-of select="document('')/xsl:stylesheet/namespace::*[name()!='xsl']"/>
+     <xsl:copy-of select="document('')/xsl:stylesheet/namespace::*[name()!='xsl' and name()!='fn']"/>
     <xsl:attribute name="service"><xsl:value-of select="'WPS'"></xsl:value-of></xsl:attribute>
      <xsl:attribute name="version"><xsl:value-of select="'1.0.0'"></xsl:value-of></xsl:attribute>
      
@@ -36,7 +39,7 @@
               <!-- ComplexData-->
               <wps:Input>
                 <ows:Identifier>
-                  <xsl:value-of select="name(.)"/>
+                  <xsl:value-of select="fn:getCorrectInputID(name(.))"/>
                 </ows:Identifier>
                 <wps:Data>
                   <wps:ComplexData>
@@ -59,7 +62,7 @@
                   <!--ComplexData URLReference -->
                   <wps:Input xmlns:xlink="http://www.w3.org/1999/xlink">
                     <ows:Identifier>
-                      <xsl:value-of select="name(.)"/>
+                      <xsl:value-of select="fn:getCorrectInputID(name(.))"/>
                     </ows:Identifier>
                     <wps:Reference>
                       <xsl:attribute name="xlink:href">
@@ -75,7 +78,7 @@
                   <!-- Simple LiteralData -->
                   <wps:Input xmlns:xlink="http://www.w3.org/1999/xlink">
                     <ows:Identifier>
-                      <xsl:value-of select="name(.)"/>
+                      <xsl:value-of select="fn:getCorrectInputID(name(.))"/>
                     </ows:Identifier>
                     <wps:Data>
                       <wps:LiteralData>

Modified: branches/pywps-3.2-soap/pywps/XSLT/WPS2SOAP.xsl
===================================================================
--- branches/pywps-3.2-soap/pywps/XSLT/WPS2SOAP.xsl	2011-02-11 16:51:29 UTC (rev 1128)
+++ branches/pywps-3.2-soap/pywps/XSLT/WPS2SOAP.xsl	2011-02-22 08:52:31 UTC (rev 1129)
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:fn="http://pywps.wald.intevation.org/functions">
 	<xsl:template match="/">
 	
 	<!-- Either the response is a processAccepted (async) or ProcessSucceeded (sync or final result from async) -->
@@ -30,11 +31,11 @@
 			
 			<xsl:choose>
 			<xsl:when test="count(./*/*[local-name()='LiteralData'])>0"> <!--LiteralData type -->
-				<xsl:variable name="literalIdentifier" select="concat(./*[local-name()='Identifier']/text(),'Result')"/>
+				<xsl:variable name="literalIdentifier" select="concat(fn:flagRemover(string(./*[local-name()='Identifier']/text())),'Result')"/>
 				<xsl:element name="{$literalIdentifier}"><xsl:value-of select="./*/*[local-name()='LiteralData']/text()"/></xsl:element>			
 			</xsl:when>
 			<xsl:otherwise> <!--  ComplexData -->
-			<xsl:variable name="complexIdentifier" select="concat(./*[local-name()='Identifier']/text(),'Result')"/>
+			<xsl:variable name="complexIdentifier" select="concat(fn:flagRemover(string(./*[local-name()='Identifier']/text())),'Result')"/>
 			  <!--ComplexData may contain XML or string -->
 			  <xsl:choose>
 			  <xsl:when test="./*/*/*">

Modified: branches/pywps-3.2-soap/pywps/XSLT/describeProcess2WSDL.xsl
===================================================================
--- branches/pywps-3.2-soap/pywps/XSLT/describeProcess2WSDL.xsl	2011-02-11 16:51:29 UTC (rev 1128)
+++ branches/pywps-3.2-soap/pywps/XSLT/describeProcess2WSDL.xsl	2011-02-22 08:52:31 UTC (rev 1129)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- ${workspace_loc:/GetCapabilities2WSDL/getCapabilities.xml} -->
-
+<!-- Using regular expressions to remove all non acceptable start tag char -->
 <!-- REPLACEME == serverURL  and it needs to be done externaly-->
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 		xmlns:tns="REPLACEME_wsdl"
@@ -9,36 +9,34 @@
         xmlns:wps="http://www.opengis.net/wps/1.0.0"
         xmlns:ows="http://www.opengis.net/ows/1.1"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl">
+        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl"
+        xmlns:fn="http://pywps.wald.intevation.org/functions">
+ 
 <xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>        
 <!-- External variables passed by Python to the XSLT transformer -->                
-<xsl:param name="serverURL"/>
+ <xsl:param name="serverURL"/> 
 <xsl:param name="serverName"/>
-
 <!-- No longer necessary to set serverURL and serverName -->
-<!--  
+ <!-- 
 <xsl:variable name="serverURL"><xsl:value-of select="'http://localhost/wps.cgi'"></xsl:value-of></xsl:variable>
 <xsl:variable name="serverName"><xsl:value-of select="'PywpsServer'"></xsl:value-of></xsl:variable> 
--->
+ -->
 
+<!--  Example of regex with EXSTL -->
+<!--   
+ <xsl:attribute name="name"><xsl:value-of select="concat(regexp:replace(./*[local-name()='Identifier'],'^[^_:A-Za-z]','g',''),'Result')"></xsl:value-of></xsl:attribute>
+ -->
+ 	
 	<xsl:template match="/">
 	
 
 		  <xsl:element name="definitions">
 		  <!--  Hack, the namespaces are copied from the <stylesheet> element -->
-		  <xsl:copy-of select="document('')/xsl:stylesheet/namespace::*[name()!='xsl']"/>
+		  <xsl:copy-of select="document('')/xsl:stylesheet/namespace::*[name()!='xsl' and name()!='fn']"/>
             <xsl:attribute name="targetNamespace"><xsl:value-of select="concat($serverURL,'_wsdl')" /></xsl:attribute>
 		  
 		  <xsl:element name="types">
 		  		<!-- Generic WPS support -->
-		  		<!-- Special type for any sort of XML inside the response, this allows for some used of the XMLsplitter in taverna.
-		  		The xsd: namespace is necessary here otherwise the parser will assume wsdl: and will crash. Everything we have an undefined dataType the system will use this -->
-		  <!-- 		<xsd:schema><xsd:complexType name="anyXMLType" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.opengis.net/wps/1.0.0">
-                							<xsd:sequence>
-            								<xsd:any namespace="##any" processContents="lax" minOccurs="1" maxOccurs="1"></xsd:any>
-            								</xsd:sequence>
-            								</xsd:complexType></xsd:schema> -->
-		  		
 		  		<!-- Exception report -->
 		  	 <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema"><xsl:attribute name="targetNamespace"><xsl:value-of select="'http://www.opengis.net/ows/1.1'"></xsl:value-of></xsl:attribute>
 				<xsl:element name="include" namespace="http://www.w3.org/2001/XMLSchema"><xsl:attribute name="schemaLocation"><xsl:value-of select="'http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd'" /></xsl:attribute></xsl:element>	  	
@@ -72,23 +70,91 @@
 		  	<!-- End of General WPS support -->
 		  <!-- ExecuteProcess support -->
 		  <!-- loop thru processes and set the xsd types -->
-		  
 		  <xsl:for-each select="//*[local-name()='ProcessDescription']">
-		  	
-		  		<xsl:call-template name="typeDescribe">
-		  			<xsl:with-param name="async" select="false()" />
-		  			<xsl:with-param name="processID" select="concat('ExecuteProcess_',./*[local-name()='Identifier'])"/>
-		  		    </xsl:call-template>
-		  	
-		  	
-		  		<xsl:if test="string(./@storeSupported)='true' and string(./@statusSupported)='true'">
-		  			<xsl:call-template name="typeDescribe">
-		  			<xsl:with-param name="async" select="true()" />
-		  			<xsl:with-param name="processID" select="concat('ExecuteProcessAsync_',./*[local-name()='Identifier'])"/>
-		  			</xsl:call-template>
-		  		</xsl:if>
-		  		
-		  		
+		  	         <xsl:variable name="processID" select="concat('ExecuteProcess_',./*[local-name()='Identifier'])"></xsl:variable>
+		  	         <!-- Inputs -->
+					 <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema"><xsl:attribute name="targetNamespace"><xsl:value-of select="'http://www.opengis.net/wps/1.0.0'"></xsl:value-of></xsl:attribute>
+		  	         <xsl:element name="element" namespace="http://www.w3.org/2001/XMLSchema">
+		  	         	
+		  	         	<xsl:attribute name="name"><xsl:value-of select="$processID"></xsl:value-of></xsl:attribute>
+		  	             <xsl:element name="complexType" namespace="http://www.w3.org/2001/XMLSchema">
+		  	             	<xsl:element name="sequence" namespace="http://www.w3.org/2001/XMLSchema">
+		  	             		<!-- Getting the Input value: minOccurs, maxOccurs,Identifier, and datatype (LiteralData) from each input -->
+		  	             		<xsl:for-each select="./*/*[local-name()='Input']">
+		  	             			<xsl:element name="element" namespace="http://www.w3.org/2001/XMLSchema">
+		  	             				<xsl:attribute name="minOccurs"><xsl:value-of select="./@minOccurs"></xsl:value-of></xsl:attribute>
+		  	             				<xsl:attribute name="maxOccurs"><xsl:value-of select="./@maxOccurs"></xsl:value-of></xsl:attribute>
+		  	             				<xsl:attribute name="name"><xsl:value-of select="fn:flagRemover(string(./*[local-name()='Identifier']))"></xsl:value-of>
+		  	             				<!--<xsl:value-of select="./*[local-name()='Identifier']"></xsl:value-of>  -->
+		  	             				
+		  	             				</xsl:attribute>
+		  	             				<!--  If to fecth datatype, its not safe to use ows:reference better to get the element value -->
+		  	             					<!--  If no dataType then we need to  -->
+		  	             					<xsl:choose>
+		  	             					<xsl:when test="./*/*[local-name()='DataType']">
+		  	             					<xsl:attribute name="type"><xsl:value-of select="concat('xsd:',./*/*[local-name()='DataType'])"></xsl:value-of></xsl:attribute>
+		  	             				    </xsl:when>
+		  	             				    <xsl:otherwise> <!--  if no datatype then we are dealing with some sorte of complexData XML -->
+		  	             				    
+		  	             				    </xsl:otherwise>
+		  	             				    	<complexType>
+                <sequence>
+            	<any namespace="##any" processContents="skip" minOccurs="1" maxOccurs="1"></any>
+            	</sequence>
+            	</complexType>
+		  	             				    </xsl:choose>
+		  	             				    
+		  	             				    
+		  	             
+		  	             			</xsl:element><!-- End of element inside sequence -->		
+		  	             		
+		  	             		</xsl:for-each> <!-- end of Input loop -->
+		  	             	
+		  	             	
+		  	             	
+		  	             	</xsl:element><!--  End of sequence --> 
+		  	             
+		  	             </xsl:element> <!-- End of complexType -->
+		  	             
+		  			</xsl:element><!-- End of element ExecuteProcess  Input definition -->
+		  			</xsl:element><!-- End of xsd:schema End of inputs -->
+		  			<!--  Outputs/Response -->
+		  			 <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema"><xsl:attribute name="targetNamespace"><xsl:value-of select="'http://www.opengis.net/wps/1.0.0'"></xsl:value-of></xsl:attribute>
+		  			 <xsl:element name="element" namespace="http://www.w3.org/2001/XMLSchema">
+		  			 <!-- Using processID from above -->
+		  			 <xsl:attribute name="name"><xsl:value-of select="concat($processID,'Response')"></xsl:value-of></xsl:attribute>
+		  			 	 <xsl:element name="complexType" namespace="http://www.w3.org/2001/XMLSchema">
+		  			 	 <xsl:element name="sequence" namespace="http://www.w3.org/2001/XMLSchema">
+		  			 	 <!-- Getting the Ouput value: ,Identifier, and datatype (LiteralData) from each input -->
+		  			 	 <xsl:for-each select="./*/*[local-name()='Output']">
+		  			 	 <xsl:element name="element" namespace="http://www.w3.org/2001/XMLSchema">
+		  			 	 
+		  			 	 <!-- <xsl:attribute name="name"><xsl:value-of select="concat(./*[local-name()='Identifier'],'Result')"></xsl:value-of></xsl:attribute> -->
+		  			 	 <xsl:attribute name="name"><xsl:value-of select="concat(fn:flagRemover(string(./*[local-name()='Identifier'])),'Result')"></xsl:value-of></xsl:attribute>
+		  			 	 <!--  not certain if a default minOccurs and maxOccurs should be set -->
+		  			 	 <xsl:attribute name="minOccurs"><xsl:value-of select="'1'"></xsl:value-of></xsl:attribute>
+		  	             <xsl:attribute name="maxOccurs"><xsl:value-of select="'1'"></xsl:value-of></xsl:attribute>
+		  			 	 <xsl:if test="./*/*[local-name()='DataType']"> <!-- In case we have simple literal output -->
+		  	             	<xsl:attribute name="type"><xsl:value-of select="concat('xsd:',./*/*[local-name()='DataType'])"></xsl:value-of></xsl:attribute>
+		  	             </xsl:if>
+		  			 	 
+		  			 	 </xsl:element><!-- response result element -->
+		  			 	 
+		  			 	 
+		  			 	 
+		  			 	 
+		  			 	 </xsl:for-each> <!-- End of output loop -->
+		  			 	 
+		  			 	 </xsl:element> <!-- sequence element end -->
+		  			 	 
+		  			 	 
+		  			 	 </xsl:element> <!-- ComplexType end -->
+		  			 </xsl:element> <!-- End of elemement with process response name -->
+		  			 </xsl:element><!-- End of xsd:schema End of output -->
+		  			 
+
+		  
+		  
 		  </xsl:for-each><!-- End of DescribeProcess loop for types -->
 		  
 		  </xsl:element> <!-- End of types element -->
@@ -130,20 +196,19 @@
 		<!--  Process loop to fetch name -->
 		<!-- Its better to do another loop than one giant loop with everythin -->
 		<xsl:for-each select="//*[local-name()='ProcessDescription']">
+		<xsl:variable name="processID" select="concat('ExecuteProcess_',./*[local-name()='Identifier'])"></xsl:variable>
 		
-			<xsl:call-template name="messageDescribe">
-		  			<xsl:with-param name="async" select="false()" />
-		  			<xsl:with-param name="processID" select="concat('ExecuteProcess_',./*[local-name()='Identifier'])"/>
-		  		    </xsl:call-template>
-		  	
-		  	
-		  		<xsl:if test="string(./@storeSupported)='true' and string(./@statusSupported)='true'">
-		  			<xsl:call-template name="messageDescribe">
-		  			<xsl:with-param name="async" select="true()" />
-		  			<xsl:with-param name="processID" select="concat('ExecuteProcessAsync_',./*[local-name()='Identifier'])"/>
-		  			</xsl:call-template>
-		  		</xsl:if>
+			<!-- request message -->
+			<xsl:element name="message"><xsl:attribute name="name"><xsl:value-of select="concat($processID,'Request')"></xsl:value-of></xsl:attribute>
+				<xsl:element name="part"><xsl:attribute name="name"><xsl:value-of select="'DataInputs'"></xsl:value-of></xsl:attribute>
+		  	         <xsl:attribute name="element"><xsl:value-of select="concat('wps:',$processID)"></xsl:value-of></xsl:attribute></xsl:element>
+			</xsl:element>
 			
+			<!--  response message -->
+			<xsl:element name="message"><xsl:attribute name="name"><xsl:value-of select="concat($processID,'Response')"></xsl:value-of></xsl:attribute>
+				<xsl:element name="part"><xsl:attribute name="name"><xsl:value-of select="'ProcessOutputs'"></xsl:value-of></xsl:attribute>
+		  	         <xsl:attribute name="element"><xsl:value-of select="concat('wps:',$processID,'Response')"></xsl:value-of></xsl:attribute></xsl:element>
+			</xsl:element>
 
 		</xsl:for-each> <!-- End of process description loop for message -->
 		
@@ -171,24 +236,15 @@
 		   </xsl:element><!--  end of operation -->
 		
 		   <!-- Processes operations -->
-		   
 		   <xsl:for-each select="//*[local-name()='ProcessDescription']">
-		
-			<xsl:call-template name="operationDescribe">
-		  			<xsl:with-param name="async" select="false()" />
-		  			<xsl:with-param name="processID" select="concat('ExecuteProcess_',./*[local-name()='Identifier'])"/>
-		  		    </xsl:call-template>
-		  	
-		  		<xsl:if test="string(./@storeSupported)='true' and string(./@statusSupported)='true'">
-		  			<xsl:call-template name="operationDescribe">
-		  			<xsl:with-param name="async" select="true()" />
-		  			<xsl:with-param name="processID" select="concat('ExecuteProcessAsync_',./*[local-name()='Identifier'])"/>
-		  			</xsl:call-template>
-		  		</xsl:if>
-			
-
-		</xsl:for-each>
-		   
+				<xsl:variable name="processID" select="concat('ExecuteProcess_',./*[local-name()='Identifier'])"></xsl:variable><!-- Note: variable only exist inside the loop -->
+		     
+		     	<xsl:element name="operation"><xsl:attribute name="name"><xsl:value-of select="$processID"></xsl:value-of></xsl:attribute>
+		     	<xsl:element name="input"><xsl:attribute name="message"><xsl:value-of select="concat('tns:',$processID,'Request')"></xsl:value-of></xsl:attribute></xsl:element>
+		     	<xsl:element name="output"><xsl:attribute name="message"><xsl:value-of select="concat('tns:',$processID,'Response')"></xsl:value-of></xsl:attribute></xsl:element>
+		     	<xsl:element name="fault"><xsl:attribute name="name"><xsl:value-of select="'ExceptionResponse'"></xsl:value-of></xsl:attribute><xsl:attribute name="message"><xsl:value-of select="'tns:ExceptionResponse'"></xsl:value-of></xsl:attribute></xsl:element>
+		   	</xsl:element>  
+		   </xsl:for-each>
 		   <!--  end of operation -->
 		   
 		   </xsl:element> <!-- End of portType -->
@@ -248,21 +304,23 @@
 		   
 		   <!-- Loop for each operation -->
 		   <xsl:for-each select="//*[local-name()='ProcessDescription']">
-		   
 		   <xsl:variable name="processID" select="concat('ExecuteProcess_',./*[local-name()='Identifier'])"></xsl:variable><!-- Note: variable only exist inside the loop -->
-		   <xsl:call-template name="bindingDescribe">
-		  			<xsl:with-param name="async" select="false()" />
-		  			<xsl:with-param name="processID" select="concat('ExecuteProcess_',./*[local-name()='Identifier'])"/>
-		  		    </xsl:call-template>
-		  	
-		  		<xsl:if test="string(./@storeSupported)='true' and string(./@statusSupported)='true'">
-		  			<xsl:call-template name="bindingDescribe">
-		  			<xsl:with-param name="async" select="true()" />
-		  			<xsl:with-param name="processID" select="concat('ExecuteProcessAsync_',./*[local-name()='Identifier'])"/>
-		  			</xsl:call-template>
-		  		</xsl:if>
+		   <xsl:element name="operation"><xsl:attribute name="name"><xsl:value-of select="$processID"></xsl:value-of></xsl:attribute>
+		   		<xsl:element name="operation" namespace="http://schemas.xmlsoap.org/wsdl/soap/"><xsl:attribute name="soapAction"><xsl:value-of select="concat($serverURL,'/',$processID)"></xsl:value-of></xsl:attribute><xsl:attribute name="style"><xsl:value-of select="'document'"></xsl:value-of></xsl:attribute></xsl:element>
+		   		
+		   		<xsl:element name="input"><xsl:attribute name="name"><xsl:value-of select="concat($processID,'Request')"></xsl:value-of></xsl:attribute>
+		   			<xsl:element name="body" namespace="http://schemas.xmlsoap.org/wsdl/soap/"><xsl:attribute name="use"><xsl:value-of select="'literal'"></xsl:value-of></xsl:attribute></xsl:element>
+		   		</xsl:element><!-- end input -->
+		   		
+		   		<xsl:element name="output"><xsl:attribute name="name"><xsl:value-of select="concat($processID,'Response')"></xsl:value-of></xsl:attribute>
+		   			<xsl:element name="body" namespace="http://schemas.xmlsoap.org/wsdl/soap/"><xsl:attribute name="use"><xsl:value-of select="'literal'"></xsl:value-of></xsl:attribute></xsl:element>
+		   		</xsl:element><!-- end input -->
+		   		
+		   		<xsl:element name="fault"><xsl:attribute name="name"><xsl:value-of select="'ExceptionResponse'"></xsl:value-of></xsl:attribute>
+		   			<xsl:element name="fault" namespace="http://schemas.xmlsoap.org/wsdl/soap/"><xsl:attribute name="name"><xsl:value-of select="'ExceptionResponse'"></xsl:value-of></xsl:attribute><xsl:attribute name="use"><xsl:value-of select="'literal'"></xsl:value-of></xsl:attribute></xsl:element>
+		   		</xsl:element><!-- end input -->
+		   </xsl:element><!-- end operation  -->
 		   
-		   
 		   </xsl:for-each> <!-- End of SOAP operation for each process -->
 		   
 		   </xsl:element><!--End of binding -->
@@ -279,171 +337,6 @@
 	
 	</xsl:element> <!-- end of service element -->		     
 		  </xsl:element> <!-- End of definitions, end of WSDL -->
-		
+		 <foo><xsl:value-of select="$serverName" /></foo>
 	</xsl:template>
-	
-<!-- types ProcessDescription template-->
-	
-<xsl:template name="typeDescribe" >
-<xsl:param name="async"/>
-<xsl:param name="processID"/>
-
-		  	         <!-- Inputs -->
-		  	        
-		  	      
-					 <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema"><xsl:attribute name="targetNamespace"><xsl:value-of select="'http://www.opengis.net/wps/1.0.0'"></xsl:value-of></xsl:attribute>
-		  	         <xsl:element name="element" namespace="http://www.w3.org/2001/XMLSchema">
-		  	         	
-		  	         	<xsl:attribute name="name"><xsl:value-of select="$processID"></xsl:value-of></xsl:attribute>
-		  	             <xsl:element name="complexType" namespace="http://www.w3.org/2001/XMLSchema">
-		  	             	<xsl:element name="sequence" namespace="http://www.w3.org/2001/XMLSchema">
-		  	             		<!-- Getting the Input value: minOccurs, maxOccurs,Identifier, and datatype (LiteralData) from each input -->
-		  	             		<xsl:for-each select="./*/*[local-name()='Input']">
-		  	             			<xsl:element name="element" namespace="http://www.w3.org/2001/XMLSchema">
-		  	             				<xsl:attribute name="minOccurs"><xsl:value-of select="./@minOccurs"></xsl:value-of></xsl:attribute>
-		  	             				<xsl:attribute name="maxOccurs"><xsl:value-of select="./@maxOccurs"></xsl:value-of></xsl:attribute>
-		  	             				<xsl:attribute name="name"><xsl:value-of select="./*[local-name()='Identifier']"></xsl:value-of></xsl:attribute>
-		  	             				<!--  If to fecth datatype, its not safe to use ows:reference better to get the element value -->
-		  	             					<!--  If no dataType then we need to  -->
-		  	             					
-		  	             					<xsl:if test="./*/*[local-name()='DataType']">
-		  	             					<xsl:attribute name="type"><xsl:value-of select="concat('xsd:',./*/*[local-name()='DataType'])"></xsl:value-of></xsl:attribute>
-		  	             				    </xsl:if>	  	        				    
-		  	             
-		  	             			</xsl:element><!-- End of element inside sequence -->		
-		  	             		</xsl:for-each> <!-- end of Input loop -->
-             	
-		  	             	</xsl:element><!--  End of sequence --> 
-		  	             
-		  	             </xsl:element> <!-- End of complexType -->
-		  	             
-		  			</xsl:element><!-- End of element ExecuteProcess  Input definition -->
-		  			</xsl:element><!-- End of xsd:schema End of inputs -->
-		  			
-		  			<!--  Outputs/Response -->
-		  			 <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema"><xsl:attribute name="targetNamespace"><xsl:value-of select="'http://www.opengis.net/wps/1.0.0'"></xsl:value-of></xsl:attribute>
-		  			 <xsl:element name="element" namespace="http://www.w3.org/2001/XMLSchema">
-		  			 <!-- Using processID from above -->
-		  			 <xsl:attribute name="name"><xsl:value-of select="concat($processID,'Response')"></xsl:value-of></xsl:attribute>
-		  			 	 <xsl:element name="complexType" namespace="http://www.w3.org/2001/XMLSchema">
-		  			 	 <xsl:element name="sequence" namespace="http://www.w3.org/2001/XMLSchema">
-		  			 	 
-		  			 	 
-		  			 	 <!-- Getting the Ouput value: ,Identifier, and datatype (LiteralData) from each input -->
-		  			 	 <!-- If we have ascyn process then there is only one result -->
-		  			 	 <xsl:choose>
-		  			 	 <xsl:when test="$async">
-		  			 	 	<!-- Element supporting URL -->
-		  			 	 <xsl:element name="element" namespace="http://www.w3.org/2001/XMLSchema">
-		  			 	    <xsl:attribute name="name"><xsl:value-of select="'statusURLResult'"></xsl:value-of></xsl:attribute>
-		  			 	     <xsl:attribute name="minOccurs"><xsl:value-of select="'1'"></xsl:value-of></xsl:attribute>
-		  	               <xsl:attribute name="maxOccurs"><xsl:value-of select="'1'"></xsl:value-of></xsl:attribute>
-		  			 	 </xsl:element>
-		  			 	 </xsl:when>
-		  			 	 
-		  			 	 <xsl:otherwise>
-		  			 	 <xsl:for-each select="./*/*[local-name()='Output']">
-		  			 	 <xsl:element name="element" namespace="http://www.w3.org/2001/XMLSchema">
-		  			 	 <xsl:attribute name="name"><xsl:value-of select="concat(./*[local-name()='Identifier'],'Result')"></xsl:value-of></xsl:attribute>
-		  			 	 <!--  not certain if a default minOccurs and maxOccurs should be set -->
-		  			 	 <xsl:attribute name="minOccurs"><xsl:value-of select="'1'"></xsl:value-of></xsl:attribute>
-		  	             <xsl:attribute name="maxOccurs"><xsl:value-of select="'1'"></xsl:value-of></xsl:attribute>
-		  						<xsl:if test="./*/*[local-name()='DataType']">
-		  	             					<xsl:attribute name="type"><xsl:value-of select="concat('xsd:',./*/*[local-name()='DataType'])"></xsl:value-of></xsl:attribute>
-		  	             				    </xsl:if>
-     				 		
-		  	         <!--      <xsl:choose> 
-		  	             					<xsl:when test="./*/*[local-name()='DataType']">
-		  	             					<xsl:attribute name="type"><xsl:value-of select="concat('xsd:',./*/*[local-name()='DataType'])"></xsl:value-of></xsl:attribute>
-		  	             				    </xsl:when>
-		  	             				    <xsl:otherwise> 
-		  	             				    <xsl:attribute name="type"><xsl:value-of select="'wps:anyXMLType'"></xsl:value-of></xsl:attribute>
-		  	             				   
-		  	             				    </xsl:otherwise>
-		  	             				    	
-		 	             </xsl:choose>
-		 	              -->
-		  	              
-		  	             
-		  	             <xsl:if test="./*/*[local-name()='DataType']">
-		  	             					<xsl:attribute name="type"><xsl:value-of select="concat('xsd:',./*/*[local-name()='DataType'])"></xsl:value-of></xsl:attribute>
-		  	             				    </xsl:if>
-		  			 	 
-		  			 	 </xsl:element><!-- response result element -->
-		  			 	 
-		  			 	 
-		  			 	 
-		  			 	 
-		  			 	 </xsl:for-each> <!-- End of output loop -->
-		  			 	 </xsl:otherwise> <!-- End of sync reponse from choose -->
-		  			 	 </xsl:choose> <!-- end of Async or sync output -->
-		  			 	 
-		  			 	 
-		  			 	 </xsl:element> <!-- sequence element end -->
-		  			 	 
-		  			 	 
-		  			 	 </xsl:element> <!-- ComplexType end -->
-		  			 </xsl:element> <!-- End of elemement with process response name -->
-		  			 
-		  			 <!-- adding anyXMLType -->
-		  			<!--    <complexType name="anyXMLType" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.opengis.net/wps/1.0.0">
-                							<sequence>
-            								<any namespace="##any" processContents="lax" minOccurs="1" maxOccurs="1"></any>
-            								</sequence>
-            								</complexType>-->
-		  			 
-		  			 </xsl:element><!-- End of xsd:schema End of output -->
-		  			 
-</xsl:template>	
-
-<xsl:template name="messageDescribe">
-<xsl:param name="async"/>
-<xsl:param name="processID"/>
-		
-			<!-- request message -->
-			<xsl:element name="message"><xsl:attribute name="name"><xsl:value-of select="concat($processID,'Request')"></xsl:value-of></xsl:attribute>
-				<xsl:element name="part"><xsl:attribute name="name"><xsl:value-of select="'DataInputs'"></xsl:value-of></xsl:attribute>
-		  	         <xsl:attribute name="element"><xsl:value-of select="concat('wps:',$processID)"></xsl:value-of></xsl:attribute></xsl:element>
-			</xsl:element>
-			
-			<!--  response message -->
-			<xsl:element name="message"><xsl:attribute name="name"><xsl:value-of select="concat($processID,'Response')"></xsl:value-of></xsl:attribute>
-				<xsl:element name="part"><xsl:attribute name="name"><xsl:value-of select="'ProcessOutputs'"></xsl:value-of></xsl:attribute>
-		  	         <xsl:attribute name="element"><xsl:value-of select="concat('wps:',$processID,'Response')"></xsl:value-of></xsl:attribute></xsl:element>
-			</xsl:element>
-</xsl:template>	
-	
-<xsl:template name="operationDescribe">
-<xsl:param name="async"/>
-<xsl:param name="processID"/>
-		<!-- Operation section inside portType -->
-	
-		     
-		     	<xsl:element name="operation"><xsl:attribute name="name"><xsl:value-of select="$processID"></xsl:value-of></xsl:attribute>
-		     	<xsl:element name="input"><xsl:attribute name="message"><xsl:value-of select="concat('tns:',$processID,'Request')"></xsl:value-of></xsl:attribute></xsl:element>
-		     	<xsl:element name="output"><xsl:attribute name="message"><xsl:value-of select="concat('tns:',$processID,'Response')"></xsl:value-of></xsl:attribute></xsl:element>
-		     	<xsl:element name="fault"><xsl:attribute name="name"><xsl:value-of select="'ExceptionResponse'"></xsl:value-of></xsl:attribute><xsl:attribute name="message"><xsl:value-of select="'tns:ExceptionResponse'"></xsl:value-of></xsl:attribute></xsl:element>
-		   	</xsl:element>  
-</xsl:template>
-
-<xsl:template name="bindingDescribe">
-<xsl:param name="async"/>
-<xsl:param name="processID"/>
-   <xsl:element name="operation"><xsl:attribute name="name"><xsl:value-of select="$processID"></xsl:value-of></xsl:attribute>
-		   		<xsl:element name="operation" namespace="http://schemas.xmlsoap.org/wsdl/soap/"><xsl:attribute name="soapAction"><xsl:value-of select="concat($serverURL,'/',$processID)"></xsl:value-of></xsl:attribute><xsl:attribute name="style"><xsl:value-of select="'document'"></xsl:value-of></xsl:attribute></xsl:element>
-		   		
-		   		<xsl:element name="input"><xsl:attribute name="name"><xsl:value-of select="concat($processID,'Request')"></xsl:value-of></xsl:attribute>
-		   			<xsl:element name="body" namespace="http://schemas.xmlsoap.org/wsdl/soap/"><xsl:attribute name="use"><xsl:value-of select="'literal'"></xsl:value-of></xsl:attribute></xsl:element>
-		   		</xsl:element><!-- end input -->
-		   		
-		   		<xsl:element name="output"><xsl:attribute name="name"><xsl:value-of select="concat($processID,'Response')"></xsl:value-of></xsl:attribute>
-		   			<xsl:element name="body" namespace="http://schemas.xmlsoap.org/wsdl/soap/"><xsl:attribute name="use"><xsl:value-of select="'literal'"></xsl:value-of></xsl:attribute></xsl:element>
-		   		</xsl:element><!-- end input -->
-		   		
-		   		<xsl:element name="fault"><xsl:attribute name="name"><xsl:value-of select="'ExceptionResponse'"></xsl:value-of></xsl:attribute>
-		   			<xsl:element name="fault" namespace="http://schemas.xmlsoap.org/wsdl/soap/"><xsl:attribute name="name"><xsl:value-of select="'ExceptionResponse'"></xsl:value-of></xsl:attribute><xsl:attribute name="use"><xsl:value-of select="'literal'"></xsl:value-of></xsl:attribute></xsl:element>
-		   		</xsl:element><!-- end input -->
-		   </xsl:element><!-- end operation  -->
-</xsl:template>
-	
 </xsl:stylesheet>
\ No newline at end of file



More information about the Pywps-commits mailing list