You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by aj...@apache.org on 2005/08/31 14:42:35 UTC

svn commit: r265035 - in /webservices/axis2/trunk/java/modules/wsdl/src/org/apache: axis2/wsdl/builder/wsdl4j/ axis2/wsdl/template/java/ wsdl/extensions/impl/

Author: ajith
Date: Wed Aug 31 05:42:14 2005
New Revision: 265035

URL: http://svn.apache.org/viewcvs?rev=265035&view=rev
Log:
Fixing the SOAP 1.2 Address issue.

Modified:
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/ExtensionFactoryImpl.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/SOAPAddressImpl.java

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java?rev=265035&r1=265034&r2=265035&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java Wed Aug 31 05:42:14 2005
@@ -701,8 +701,8 @@
 
             if (wsdl4jElement instanceof UnknownExtensibilityElement) {
                 UnknownExtensibilityElement unknown = (UnknownExtensibilityElement) (wsdl4jElement);
-                //look for the SOAP 1.2 stuff here. WSDL4j does not understand SOAP 1.2 things
 
+                //look for the SOAP 1.2 stuff here. WSDL4j does not understand SOAP 1.2 things
                 if (ExtensionConstants.SOAP_12_OPERATION.equals(unknown.getElementType())){
                     org.apache.wsdl.extensions.SOAPOperation soapOperationExtensibiltyElement = (org.apache.wsdl.extensions.SOAPOperation) extensionFactory
                             .getExtensionElement(wsdl4jElement.getElementType());
@@ -732,7 +732,13 @@
                     soapBindingExtensibiltyElement.setStyle(element.getAttribute("style"));
 
                     component.addExtensibilityElement(soapBindingExtensibiltyElement);
-                } else{
+                } else if (ExtensionConstants.SOAP_12_ADDRESS.equals(unknown.getElementType())){
+                     org.apache.wsdl.extensions.SOAPAddress soapAddressExtensibiltyElement = (org.apache.wsdl.extensions.SOAPAddress) extensionFactory
+                            .getExtensionElement(wsdl4jElement.getElementType());
+                    Element element = unknown.getElement();
+                    soapAddressExtensibiltyElement.setLocationURI(element.getAttribute("location"));
+                    component.addExtensibilityElement(soapAddressExtensibiltyElement);
+                }else{
 
                     DefaultExtensibilityElement defaultExtensibilityElement = (DefaultExtensibilityElement) extensionFactory
                             .getExtensionElement(wsdl4jElement.getElementType());

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl?rev=265035&r1=265034&r2=265035&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl Wed Aug 31 05:42:14 2005
@@ -1,140 +1,138 @@
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-	<xsl:output method="text"/>
-	<xsl:template match="/interface">
-		<xsl:variable name="skeletonname"><xsl:value-of select="@skeletonname"/></xsl:variable>
-		<xsl:variable name="dbsupportpackage"><xsl:value-of select="@dbsupportpackage"/></xsl:variable>
-	
-    package <xsl:value-of select="@package"/>;
-
-    /**
-     *  Auto generated message receiver
-     */
-
-    public class <xsl:value-of select="@name"/> extends <xsl:value-of select="@basereceiver"/>{
-    
-		public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext)
-		throws org.apache.axis2.AxisFault{
-    
-     try {
-
-            // get the implementation class for the Web Service
-            Object obj = getTheImplementationObject(msgContext);
-           
-            <xsl:value-of select="$skeletonname"/> skel = (<xsl:value-of select="$skeletonname"/>)obj;
-            //Out Envelop
-             org.apache.axis2.soap.SOAPEnvelope envelope = null;
-             //Find the operation that has been set by the Dispatch phase.
-            org.apache.axis2.description.OperationDescription op = msgContext.getOperationContext().getAxisOperation();
-            if (op == null) {
-                throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
-            }
-            
-            String methodName;
-            if(op.getName() != null &amp; (methodName = op.getName().getLocalPart()) != null){
-            
-				<xsl:for-each select="method">
-				
-			<xsl:variable name="returntype"><xsl:value-of select="output/param/@type"/></xsl:variable>
-			<xsl:variable name="returnvariable"><xsl:value-of select="output/param/@name"/></xsl:variable>
-			<xsl:variable name="namespace"><xsl:value-of select="@namespace"/></xsl:variable>
-			<xsl:variable name="dbsupportname"><xsl:value-of select="@dbsupportname"/></xsl:variable>
-			
-			<xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
-			<xsl:variable name="style"><xsl:value-of select="@style"/></xsl:variable>
-					
-					
-					if("<xsl:value-of select="@name"/>".equals(methodName)){
-											
-				
-			<xsl:if test="$returntype!=''">
-				<xsl:value-of select="$returntype"/>
-				<xsl:text> </xsl:text>
-				<xsl:value-of select="$returnvariable"/> = null;
-						</xsl:if>
-						
-						
-			<xsl:choose>			
-				<xsl:when test="$style='rpc'">
-					//rpc style				
-					<xsl:variable name="inputparamcount"><xsl:value-of select="count(input/param)"/></xsl:variable>
-				<xsl:for-each select="input/param">
-					<xsl:if test="@type!=''">
-		
-					org.apache.axis2.om.OMElement firstChild = (org.apache.axis2.om.OMElement)msgContext.getEnvelope().getBody().getFirstChild();
-					if(null == firstChild)
-						throw new org.apache.axis2.AxisFault("Wrapper Element Not Found for the operation of RPC style");
-					java.util.Iterator children = firstChild.getChildren();
-					org.apache.xmlbeans.XmlObject[] params = new org.apache.xmlbeans.XmlObject[<xsl:value-of select="$inputparamcount"/>];
-					int count = 0;
-					while(children.hasNext() &amp;&amp; count &lt; <xsl:value-of select="$inputparamcount"/>){
-						params[count] = org.soapinterop.databinding.echoStringDatabindingSupporter.fromOM((org.apache.axis2.om.OMElement)children.next(), <xsl:value-of select="@type"/>.class);
-						count++;
-					}
-				if(count!= <xsl:value-of select="$inputparamcount"/>)
-					throw new org.apache.axis2.AxisFault("Parts mismatch in the message");
-						 
-					</xsl:if>
-				</xsl:for-each>
-				
-					<xsl:if test="$returntype!=''">
-						<xsl:value-of select="$returnvariable"/> =</xsl:if> skel.<xsl:value-of select="@name"/>(
-								<xsl:for-each select="input/param">
-									<xsl:if test="@type!=''">
-										(<xsl:value-of select="@type"/>)params[<xsl:value-of select="position()-1"/>]<xsl:if test="position()!=$inputparamcount">,</xsl:if>
-									</xsl:if>
-								</xsl:for-each>);
-							//Create a default envelop
-								envelope = getSOAPFactory().getDefaultEnvelope();
-								org.apache.axis2.om.OMNamespace ns = getSOAPFactory().createOMNamespace("<xsl:value-of select="$namespace"/>", "<xsl:value-of select="$name"/>Responce");
-								org.apache.axis2.om.OMElement responseMethodName = getSOAPFactory().createOMElement(methodName + "Response", ns);
-								//Create a Omelement of the result if a result exist
-								<xsl:if test="$returntype!=''">
-									responseMethodName.setFirstChild(<xsl:value-of select="$dbsupportpackage"/>.<xsl:value-of select="$dbsupportname"/>.toOM(<xsl:value-of select="$returnvariable"/>));		
-								</xsl:if>
-											
-								envelope.getBody().setFirstChild(responseMethodName);
-				</xsl:when>
-							
-							
-							
-							
-							
-				<xsl:when test="$style='doc'">
-				//doc style
-					<xsl:if test="$returntype!=''">
-						<xsl:value-of select="$returnvariable"/> =</xsl:if> skel.<xsl:value-of select="@name"/>(<xsl:if test="input/param/@type!=''">(<xsl:value-of select="input/param/@type"/>)<xsl:value-of select="$dbsupportpackage"/>.<xsl:value-of select="$dbsupportname"/>.fromOM((org.apache.axis2.om.OMElement)msgContext.getEnvelope().getBody().getFirstElement().detach(), <xsl:value-of select="input/param/@type"/>.class)</xsl:if>);
-						
-					//Create a default envelop
-					envelope = getSOAPFactory().getDefaultEnvelope();
-					//Create a Omelement of the result if a result exist
-					
-					<xsl:if test="$returntype!=''">envelope.getBody().setFirstChild(<xsl:value-of select="$dbsupportpackage"/>.<xsl:value-of select="$dbsupportname"/>.toOM(<xsl:value-of select="$returnvariable"/>));		
-					</xsl:if>											
-				</xsl:when>
-							
-							
-				<xsl:otherwise>
-									//Unknown style!! No code is generated
-								  throw UnsupportedOperationException("Unknown Style");
-							</xsl:otherwise>
-			</xsl:choose>
-						
-						
-						
-					}
-			   </xsl:for-each>
-			   
-			   newMsgContext.setEnvelope(envelope);
+    <xsl:output method="text"/>
+    <xsl:template match="/interface">
+        <xsl:variable name="skeletonname"><xsl:value-of select="@skeletonname"/></xsl:variable>
+        <xsl:variable name="dbsupportpackage"><xsl:value-of select="@dbsupportpackage"/></xsl:variable>
+
+        package <xsl:value-of select="@package"/>;
+
+        /**
+        *  Auto generated message receiver
+        */
+
+        public class <xsl:value-of select="@name"/> extends <xsl:value-of select="@basereceiver"/>{
+
+        public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext)
+        throws org.apache.axis2.AxisFault{
+
+        try {
+
+        // get the implementation class for the Web Service
+        Object obj = getTheImplementationObject(msgContext);
+
+        <xsl:value-of select="$skeletonname"/> skel = (<xsl:value-of select="$skeletonname"/>)obj;
+        //Out Envelop
+        org.apache.axis2.soap.SOAPEnvelope envelope = null;
+        //Find the operation that has been set by the Dispatch phase.
+        org.apache.axis2.description.OperationDescription op = msgContext.getOperationContext().getAxisOperation();
+        if (op == null) {
+        throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
+        }
+
+        String methodName;
+        if(op.getName() != null &amp; (methodName = op.getName().getLocalPart()) != null){
+
+        <xsl:for-each select="method">
+
+            <xsl:variable name="returntype"><xsl:value-of select="output/param/@type"/></xsl:variable>
+            <xsl:variable name="returnvariable"><xsl:value-of select="output/param/@name"/></xsl:variable>
+            <xsl:variable name="namespace"><xsl:value-of select="@namespace"/></xsl:variable>
+            <xsl:variable name="dbsupportname"><xsl:value-of select="@dbsupportname"/></xsl:variable>
+
+            <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
+            <xsl:variable name="style"><xsl:value-of select="@style"/></xsl:variable>
+
+
+            if("<xsl:value-of select="@name"/>".equals(methodName)){
+
+
+            <xsl:if test="$returntype!=''">
+                <xsl:value-of select="$returntype"/>
+                <xsl:text> </xsl:text>
+                <xsl:value-of select="$returnvariable"/> = null;
+            </xsl:if>
+
+
+            <xsl:choose>
+                <xsl:when test="$style='rpc'">
+                    //rpc style
+                    <xsl:variable name="inputparamcount"><xsl:value-of select="count(input/param)"/></xsl:variable>
+                    <xsl:for-each select="input/param">
+                        <xsl:if test="@type!=''">
+
+                            org.apache.axis2.om.OMElement firstChild = (org.apache.axis2.om.OMElement)msgContext.getEnvelope().getBody().getFirstChild();
+                            if(null == firstChild)
+                            throw new org.apache.axis2.AxisFault("Wrapper Element Not Found for the operation of RPC style");
+                            java.util.Iterator children = firstChild.getChildren();
+                            org.apache.xmlbeans.XmlObject[] params = new org.apache.xmlbeans.XmlObject[<xsl:value-of select="$inputparamcount"/>];
+                            int count = 0;
+                            while(children.hasNext() &amp;&amp; count &lt; <xsl:value-of select="$inputparamcount"/>){
+                            params[count] = org.soapinterop.databinding.echoStringDatabindingSupporter.fromOM((org.apache.axis2.om.OMElement)children.next(), <xsl:value-of select="@type"/>.class);
+                            count++;
+                            }
+                            if(count!= <xsl:value-of select="$inputparamcount"/>)
+                            throw new org.apache.axis2.AxisFault("Parts mismatch in the message");
+
+                        </xsl:if>
+                    </xsl:for-each>
+
+                    <xsl:if test="$returntype!=''">
+                        <xsl:value-of select="$returnvariable"/> =</xsl:if> skel.<xsl:value-of select="@name"/>(
+                    <xsl:for-each select="input/param">
+                        <xsl:if test="@type!=''">
+                            (<xsl:value-of select="@type"/>)params[<xsl:value-of select="position()-1"/>]<xsl:if test="position()!=$inputparamcount">,</xsl:if>
+                        </xsl:if>
+                    </xsl:for-each>);
+                    //Create a default envelop
+                    envelope = getSOAPFactory().getDefaultEnvelope();
+                    org.apache.axis2.om.OMNamespace ns = getSOAPFactory().createOMNamespace("<xsl:value-of select="$namespace"/>", "<xsl:value-of select="$name"/>Responce");
+                    org.apache.axis2.om.OMElement responseMethodName = getSOAPFactory().createOMElement(methodName + "Response", ns);
+                    //Create a Omelement of the result if a result exist
+                    <xsl:if test="$returntype!=''">
+                        responseMethodName.setFirstChild(<xsl:value-of select="$dbsupportpackage"/>.<xsl:value-of select="$dbsupportname"/>.toOM(<xsl:value-of select="$returnvariable"/>));
+                    </xsl:if>
+
+                    envelope.getBody().setFirstChild(responseMethodName);
+                </xsl:when>
+                <xsl:when test="$style='doc'">
+                    //doc style
+                    <xsl:if test="$returntype!=''">
+                        <xsl:value-of select="$returnvariable"/> =</xsl:if> skel.<xsl:value-of select="@name"/>(
+                    <xsl:for-each select="input/param[@location='body']">
+                    (<xsl:value-of select="@type"/>)<xsl:value-of select="$dbsupportpackage"/>.<xsl:value-of select="$dbsupportname"/>.fromOM((org.apache.axis2.om.OMElement)msgContext.getEnvelope().getBody().getFirstElement().detach(), <xsl:value-of select="@type"/>.class)
+                     <xsl:if test="position() &gt; 1">,</xsl:if>                     
+                     </xsl:for-each>);
+                    //Create a default envelop
+                    envelope = getSOAPFactory().getDefaultEnvelope();
+                    //Create a Omelement of the result if a result exist
+
+                    <xsl:if test="$returntype!=''">envelope.getBody().setFirstChild(<xsl:value-of select="$dbsupportpackage"/>.<xsl:value-of select="$dbsupportname"/>.toOM(<xsl:value-of select="$returnvariable"/>));
+                    </xsl:if>
+                </xsl:when>
+
+
+                <xsl:otherwise>
+                    //Unknown style!! No code is generated
+                    throw UnsupportedOperationException("Unknown Style");
+                </xsl:otherwise>
+            </xsl:choose>
+
+
+
             }
-           
-            
+        </xsl:for-each>
+
+        newMsgContext.setEnvelope(envelope);
+        }
+
+
 
         } catch (Exception e) {
-            throw org.apache.axis2.AxisFault.makeFault(e);
+        throw org.apache.axis2.AxisFault.makeFault(e);
+        }
+        <xsl:for-each select="method"/>
+        }
+
         }
-     <xsl:for-each select="method"/>
-		 }
-	
-    }
     </xsl:template>
 </xsl:stylesheet>

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/ExtensionFactoryImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/ExtensionFactoryImpl.java?rev=265035&r1=265034&r2=265035&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/ExtensionFactoryImpl.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/ExtensionFactoryImpl.java Wed Aug 31 05:42:14 2005
@@ -56,7 +56,8 @@
             return new SOAPBindingImpl(SOAP_12_BINDING);
         if (SOAP_12_HEADER.equals(qName))
             return new SOAPHeadeImpl(SOAP_12_HEADER);
-        
+        if (SOAP_12_ADDRESS.equals(qName))
+            return new SOAPAddressImpl();
         return new DefaultExtensibilityElementImpl();
     }
 

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/SOAPAddressImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/SOAPAddressImpl.java?rev=265035&r1=265034&r2=265035&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/SOAPAddressImpl.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/SOAPAddressImpl.java Wed Aug 31 05:42:14 2005
@@ -20,6 +20,8 @@
 import org.apache.wsdl.extensions.SOAPAddress;
 import org.apache.wsdl.impl.WSDLExtensibilityElementImpl;
 
+import javax.xml.namespace.QName;
+
 /**
  * @author chathura@opensource.lk
  *         This Extensibility Element is extended to handle particularly the
@@ -34,7 +36,11 @@
 
 
     public SOAPAddressImpl() {
-        type = SOAP_11_ADDRESS;
+        this.type = SOAP_11_ADDRESS;
+    }
+
+    public SOAPAddressImpl(QName type) {
+        this.type = type;
     }