You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/12/30 21:33:53 UTC

svn commit: r360161 - in /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java: DatabindingTemplate.xsl InterfaceImplementationTemplate.xsl MessageReceiverTemplate.xsl

Author: dims
Date: Fri Dec 30 12:33:48 2005
New Revision: 360161

URL: http://svn.apache.org/viewcvs?rev=360161&view=rev
Log:
integrate ADBSOAPModelBuilder into codegen for ADB

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl?rev=360161&r1=360160&r2=360161&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl Fri Dec 30 12:33:48 2005
@@ -29,6 +29,12 @@
                   ((org.apache.axis2.om.impl.OMNodeEx)documentElement).setParent(null);
                   return documentElement;
                 }
+                
+                public org.apache.axis2.soap.SOAPEnvelope toEnvelope(org.apache.axis2.soap.SOAPFactory factory, <xsl:value-of select="@type"/> param){
+                    org.apache.axis2.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
+                    envelope.getBody().addChild(toOM(param));
+                    return envelope;
+                }
             </xsl:if>
 
         </xsl:for-each>
@@ -86,7 +92,6 @@
 
             <xsl:for-each select="param">
                 <xsl:if test="@type!=''">
-
                     public  org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/> param){
                         if (param instanceof org.apache.axis2.databinding.ADBBean){
                             org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
@@ -100,6 +105,19 @@
                             return null;
                         }
                     }
+                    
+                    public  org.apache.axis2.soap.SOAPEnvelope toEnvelope(org.apache.axis2.soap.SOAPFactory factory, <xsl:value-of select="@type"/> param){
+                        if (param instanceof org.apache.axis2.databinding.ADBBean){
+                            org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new 
+                                    org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(param.MY_QNAME),
+                                                                                     factory);
+                            return builder.getEnvelope();
+                        }else{
+                           <!-- treat this as a plain bean. use the reflective bean converter -->
+                           //todo finish this onece the bean serializer has the necessary methods
+                            return null;
+                        }
+                    }
                 </xsl:if>
             </xsl:for-each>
 
@@ -130,6 +148,10 @@
            }
 
            public  org.apache.axis2.om.OMElement  toOM(org.apache.axis2.om.OMElement param){
+               return param;
+           }
+           
+           public org.apache.axis2.soap.SOAPEnvelope toEnvelope(org.apache.axis2.soap.SOAPFactory factory, org.apache.axis2.om.OMElement param){
                return param;
            }
        </xsl:template>

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=360161&r1=360160&r2=360161&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl Fri Dec 30 12:33:48 2005
@@ -134,7 +134,6 @@
                     populateModules(_call);
 
                     org.apache.axis2.soap.SOAPEnvelope env;
-                    env = createEnvelope();
                     <xsl:variable name="count"><xsl:value-of select="count(input/param[@type!=''])"></xsl:value-of></xsl:variable>
                     <xsl:choose>
                         <!-- test the number of input parameters
@@ -151,7 +150,7 @@
 
                                     //Style is Doc.
                                     <xsl:for-each select="input/param[@location='body']">
-                                        setValueDoc(env,toOM(<xsl:value-of select="@name"/>));
+                                        env = toEnvelope(getFactory(this._clientOptions.getSoapVersionURI()), <xsl:value-of select="@name"/>);
                                     </xsl:for-each>
                                     <xsl:for-each select="input/param[@location='header']">
                                         setValueDoc(env,toOM(<xsl:value-of select="@name"/>),true);
@@ -239,7 +238,7 @@
 
                                 <xsl:when test="$style='doc'">
                                     //Style is Doc
-                                    setValueDoc(env,toOM(<xsl:value-of select="input/param[1]/@name"/>));
+                                    env = toEnvelope(getFactory(this._clientOptions.getSoapVersionURI()), <xsl:value-of select="input/param[1]/@name"/>);
                                 </xsl:when>
                                 <xsl:otherwise>
                                     //Unknown style!! No code is generated
@@ -325,7 +324,7 @@
                             <xsl:when test="$style='doc'">
                                 <!-- for the doc lit case there can be only one element. So take the first element -->
                                 //Style is Doc.
-                                setValueDoc(env,toOM(<xsl:value-of select="input/param[1]/@name"/>));
+                                env = toEnvelope(getFactory(this._clientOptions.getSoapVersionURI()), <xsl:value-of select="input/param[1]/@name"/>);
                             </xsl:when>
                             <xsl:otherwise>
                                 //Unknown style!! No code is generated

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl?rev=360161&r1=360160&r2=360161&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl Fri Dec 30 12:33:48 2005
@@ -91,22 +91,21 @@
                     </xsl:choose>
 
 
-                    //Create a default envelope
-                    envelope = getSOAPFactory(msgContext).getDefaultEnvelope();
-
-                    //Create a OMElement of the result if a result exists
-                    <xsl:if test="$returntype!=''">envelope.getBody().setFirstChild(toOM(<xsl:value-of select="$returnvariable"/>));
-                    </xsl:if>
+                    <xsl:choose>
+                      <xsl:when test="$returntype!=''">
+                        envelope = toEnvelope(getSOAPFactory(msgContext), <xsl:value-of select="$returnvariable"/>);
+                      </xsl:when>
+                      <xsl:otherwise>
+                        envelope = getSOAPFactory(msgContext).getDefaultEnvelope();
+                      </xsl:otherwise>
+                    </xsl:choose>                    
                 </xsl:when>
 
-
                 <xsl:otherwise>
                     //Unknown style!! No code is generated
                     throw UnsupportedOperationException("Unknown Style");
                 </xsl:otherwise>
             </xsl:choose>
-
-
 
             }
         </xsl:for-each>