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 ds...@apache.org on 2006/10/05 15:23:25 UTC

svn commit: r453233 - in /webservices/axis2/branches/java/1_1/modules: codegen/src/org/apache/axis2/wsdl/template/java/ jibx/src/org/apache/axis2/jibx/ jibx/src/org/apache/axis2/jibx/template/

Author: dsosnoski
Date: Thu Oct  5 06:23:25 2006
New Revision: 453233

URL: http://svn.apache.org/viewvc?view=rev&rev=453233
Log:
JiBX unwrapped client stub generation

Modified:
    webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl
    webservices/axis2/branches/java/1_1/modules/jibx/src/org/apache/axis2/jibx/CodeGenerationUtility.java
    webservices/axis2/branches/java/1_1/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl

Modified: webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl?view=diff&rev=453233&r1=453232&r2=453233
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl (original)
+++ webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl Thu Oct  5 06:23:25 2006
@@ -36,6 +36,26 @@
 
         <!-- start of the sync block -->                                          
          <xsl:if test="$isSync='1'">
+           <xsl:choose>
+             <xsl:when test="@usdbimpl='true'">
+             <!-- Unwrap input parameters to match databinding generated method -->
+        /**
+         * Auto generated method signatures
+         <xsl:for-each select="input/param/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+         */
+         public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+        <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+         <xsl:for-each select="input/param/param[@type!='']">
+            <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+          </xsl:for-each>) throws java.rmi.RemoteException
+          <!--add the faults-->
+          <xsl:for-each select="fault/param/param[@type!='']">
+          ,<xsl:value-of select="@name"/>
+          </xsl:for-each>             
+             ;
+             </xsl:when>
+             <xsl:otherwise>
+             <!-- Use object as wrapper for input parameters -->
         /**
          * Auto generated method signatures
          <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
@@ -50,6 +70,8 @@
           ,<xsl:value-of select="@name"/>
           </xsl:for-each>             
              ;
+             </xsl:otherwise>
+           </xsl:choose>
         <!-- end of the sync block -->
         </xsl:if>
 
@@ -61,20 +83,48 @@
           */
 
         public void start<xsl:value-of select="@name"/>(
+         <xsl:choose>
+           <xsl:when test="@usdbimpl='true'">
+           <!-- Unwrap input parameters to match databinding generated method -->
+         <xsl:variable name="paramCount"><xsl:value-of select="count(input/param/param[@type!=''])"></xsl:value-of></xsl:variable>
+               <xsl:for-each select="input/param/param">
+            <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"></xsl:value-of></xsl:if></xsl:for-each>
+           <xsl:if test="$paramCount>0">,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException;
+           </xsl:when>
+           <xsl:otherwise>
+           <!-- Use object as wrapper for input parameters -->
          <xsl:variable name="paramCount"><xsl:value-of select="count(input/param[@type!=''])"></xsl:value-of></xsl:variable>
                <xsl:for-each select="input/param">
             <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"></xsl:value-of></xsl:if></xsl:for-each>
            <xsl:if test="$paramCount>0">,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException;
-        </xsl:if>
+           </xsl:otherwise>
+         </xsl:choose>
 <!-- end of async block-->
 
      </xsl:if>
+     </xsl:if>
         <!-- Code for in-only mep -->
        <xsl:if test="@mep='10'">
 
        <!-- For in-only meps there would not be any asynchronous methods since there is no output -->
          /**
          * Auto generated method signature
+         <xsl:choose>
+           <xsl:when test="@usdbimpl='true'">
+           <!-- Unwrap input parameters to match databinding generated method -->
+         <xsl:for-each select="input/param/param">
+         <xsl:if test="@type!=''">*@param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
+         </xsl:text></xsl:if></xsl:for-each>
+         */
+         public  void
+        <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+         <xsl:for-each select="input/param/param">
+            <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+            </xsl:if>
+         </xsl:for-each>) throws java.rmi.RemoteException;
+           </xsl:when>
+           <xsl:otherwise>
+           <!-- Use object as wrapper for input parameters -->
          <xsl:for-each select="input/param">
          <xsl:if test="@type!=''">*@param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
          </xsl:text></xsl:if></xsl:for-each>
@@ -86,13 +136,14 @@
             </xsl:if>
          </xsl:for-each>) throws java.rmi.RemoteException;
 
+           </xsl:otherwise>
+         </xsl:choose>
         </xsl:if>
-       </xsl:for-each>
+
+      </xsl:for-each>
 
        <!-- Apply other templates --> 
        //<xsl:apply-templates/>
        }
-
-
     </xsl:template>
    </xsl:stylesheet>

Modified: webservices/axis2/branches/java/1_1/modules/jibx/src/org/apache/axis2/jibx/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/jibx/src/org/apache/axis2/jibx/CodeGenerationUtility.java?view=diff&rev=453233&r1=453232&r2=453233
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/jibx/src/org/apache/axis2/jibx/CodeGenerationUtility.java (original)
+++ webservices/axis2/branches/java/1_1/modules/jibx/src/org/apache/axis2/jibx/CodeGenerationUtility.java Thu Oct  5 06:23:25 2006
@@ -42,6 +42,7 @@
 import org.apache.axis2.wsdl.databinding.JavaTypeMapper;
 import org.apache.axis2.wsdl.util.Constants;
 import org.apache.axis2.wsdl.util.MessagePartInformationHolder;
+import org.apache.bcel.generic.Type;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
@@ -77,6 +78,19 @@
     
     private final CodeGenConfiguration codeGenConfig;
     
+    private static HashSet s_primitiveSet = new HashSet();
+    static {
+        s_primitiveSet.add("boolean");
+        s_primitiveSet.add("byte");
+        s_primitiveSet.add("char");
+        s_primitiveSet.add("double");
+        s_primitiveSet.add("float");
+        s_primitiveSet.add("int");
+        s_primitiveSet.add("long");
+        s_primitiveSet.add("short");
+        s_primitiveSet.add("void");
+    }
+    
     /**
      * Constructor.
      * 
@@ -420,10 +434,13 @@
                     
                 }
                 param.setAttribute("java-type", javatype);
+                boolean isobj = !s_primitiveSet.contains(javatype);
                 String fulltype = javatype;
                 if (isarray) {
                     fulltype += "[]";
+                    isobj = false;
                 }
+                param.setAttribute("object", Boolean.toString(isarray));
                 if (isout) {
                     wrappertype = fulltype;
                 } else {

Modified: webservices/axis2/branches/java/1_1/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl?view=diff&rev=453233&r1=453232&r2=453233
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl (original)
+++ webservices/axis2/branches/java/1_1/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl Thu Oct  5 06:23:25 2006
@@ -95,6 +95,12 @@
 
   </xsl:template>
   
+  
+  <!--
+  MESSAGE RECEIVER METHOD GENERATION
+  -->
+  
+  <!-- Invoked by main template to handle unwrapped method generation for message receiver -->
   <xsl:template match="dbmethod" mode="message-receiver">
       public org.apache.axiom.soap.SOAPEnvelope <xsl:value-of select="@receiver-name"/>(org.apache.axiom.om.OMElement element, <xsl:value-of select="/*/@skeletonname"/> skel, org.apache.axiom.soap.SOAPFactory factory) throws org.apache.axis2.AxisFault {
           org.apache.axiom.soap.SOAPEnvelope envelope = null;
@@ -102,8 +108,12 @@
               org.jibx.runtime.impl.UnmarshallingContext uctx = getNewUnmarshalContext(element);
               uctx.next();
               int index;
-    <xsl:apply-templates select="in-wrapper/parameter-element"/>
+    <xsl:apply-templates select="in-wrapper/parameter-element" mode="message-receiver"/>
+    
+    <!-- actual call handling depends on type of returned result -->
     <xsl:choose>
+    
+      <!-- returning an array of values -->
       <xsl:when test="out-wrapper/@empty='false' and out-wrapper/return-element/@array='true'">
               envelope = factory.getDefaultEnvelope();
               org.apache.axiom.om.OMElement wrapper = factory.createOMElement("<xsl:value-of select='out-wrapper/@name'/>", "<xsl:value-of select='out-wrapper/@ns'/>", "");
@@ -161,6 +171,8 @@
         </xsl:choose>
               }
       </xsl:when>
+    
+      <!-- returning a single value -->
       <xsl:when test="out-wrapper/@empty='false'">
               envelope = factory.getDefaultEnvelope();
               org.apache.axiom.om.OMElement wrapper = factory.createOMElement("<xsl:value-of select='out-wrapper/@name'/>", "<xsl:value-of select='out-wrapper/@ns'/>", "");
@@ -203,6 +215,8 @@
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
+    
+      <!-- not returning anything -->
       <xsl:otherwise>
               skel.<xsl:call-template name="call-arg-list"/>;
         <xsl:if test="count(out-wrapper)&gt;0">
@@ -210,6 +224,7 @@
               envelope.getBody().addChild(factory.createOMElement("<xsl:value-of select='out-wrapper/@name'/>", "<xsl:value-of select='out-wrapper/@ns'/>", ""););
         </xsl:if>
       </xsl:otherwise>
+      
     </xsl:choose>
           } catch (org.jibx.runtime.JiBXException e) {
               throw new org.apache.axis2.AxisFault(e);
@@ -228,7 +243,7 @@
   </xsl:template>
   
   <!-- Generate code for a particular parameter element in a message receiver method -->
-  <xsl:template match="parameter-element">
+  <xsl:template match="parameter-element" mode="message-receiver">
     <xsl:choose>
       <xsl:when test="@array='true'">
         <xsl:call-template name="unmarshal-array"/>
@@ -239,6 +254,316 @@
     </xsl:choose>
   </xsl:template>
   
+  
+  <!-- 
+  CLIENT STUB UNWRAPPED METHOD GENERATION
+  -->
+  
+  <!-- Invoked by main template to handle unwrapped method generation for client stub -->
+  <xsl:template match="dbmethod" mode="interface-implementation">
+    <xsl:variable name="return-base-type"><xsl:value-of select="out-wrapper/return-element/@java-type"/></xsl:variable>
+    <xsl:variable name="return-full-type"><xsl:value-of select="$return-base-type"/><xsl:if test="out-wrapper/return-element/@array='true'">[]</xsl:if></xsl:variable>
+    <xsl:variable name="method-name"><xsl:value-of select="@method-name"/></xsl:variable>
+    
+        /**
+         * Auto generated method signature
+         * 
+         * @see com.sosnoski.ws.library.adb.LibraryAdb#getBook
+         * @param param18
+         * 
+         */
+        public <xsl:value-of select="$return-full-type"/><xsl:text> </xsl:text><xsl:value-of select="@method-name"/>(
+    <xsl:for-each select="in-wrapper/parameter-element">
+      <xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="@java-type"/><xsl:if test="@array='true'">[]</xsl:if><xsl:text> </xsl:text><xsl:value-of select="@java-name"/>
+    </xsl:for-each>
+            ) throws java.rmi.RemoteException {
+    <!-- Simple parameter values (those with serializers) can be handled by
+      direct conversion to elements. Complex parameter values need to use data
+      sources. This code handles both types. -->
+            try {
+                javax.xml.namespace.QName opname = _operations[<xsl:apply-templates mode="get-index" select="/class/method[@name=$method-name]"></xsl:apply-templates>].getName();
+                org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(opname);
+                _operationClient.getOptions().setAction("<xsl:apply-templates mode="get-action" select="/class/method[@name=$method-name]"></xsl:apply-templates>");
+                _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+    
+                // create SOAP envelope with the payload
+                org.apache.axiom.soap.SOAPEnvelope env = createEnvelope(_operationClient.getOptions());
+                org.apache.axiom.soap.SOAPFactory factory = getFactory(_operationClient.getOptions().getSoapVersionURI());
+                org.apache.axiom.om.OMElement wrapper = factory.createOMElement("<xsl:value-of select='in-wrapper/@name'/>", "<xsl:value-of select='in-wrapper/@ns'/>", "");
+                env.getBody().addChild(wrapper);
+                org.apache.axiom.om.OMElement child;
+    <xsl:apply-templates select="in-wrapper/parameter-element" mode="interface-implementation"/>
+    
+                // adding SOAP headers
+                _serviceClient.addHeadersToEnvelope(env);
+                // create message context with that soap envelope
+                org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
+                _messageContext.setEnvelope(env);
+    
+                // add the message contxt to the operation client
+                _operationClient.addMessageContext(_messageContext);
+    
+                // execute the operation client
+                _operationClient.execute(true);
+                
+    <xsl:if test="out-wrapper/@empty='false'">
+                org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient
+                    .getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                org.apache.axiom.om.OMElement result = _returnMessageContext.getEnvelope().getFirstElement();
+                if (result != null &amp;&amp; "<xsl:value-of select='out-wrapper/@name'/>".equals(result.getLocalName()) &amp;&amp;
+                    "<xsl:value-of select='out-wrapper/@ns'/>".equals(result.getNamespace().getNamespaceURI())) {
+                    org.jibx.runtime.impl.UnmarshallingContext uctx = getNewUnmarshalContext(result);
+                    uctx.next();
+                    int index;
+      <xsl:apply-templates select="out-wrapper/return-element" mode="interface-implementation"/>
+                    return <xsl:value-of select="out-wrapper/return-element/@java-name"/>;
+                } else {
+                    throw new org.apache.axis2.AxisFault("Missing expected result wrapper element {<xsl:value-of select='out-wrapper/@ns'/>}<xsl:value-of select='out-wrapper/@name'/>");
+                }
+    </xsl:if>
+            } catch (org.jibx.runtime.JiBXException e) {
+                throw new org.apache.axis2.AxisFault(e);
+            } catch (org.apache.axis2.AxisFault f) {
+                org.apache.axiom.om.OMElement faultElt = f.getDetail();
+                if (faultElt != null) {
+                    if (faultExeptionNameMap.containsKey(faultElt.getQName())) {
+                        // make the fault by reflection
+                        try {
+                            java.lang.String exceptionClassName = (java.lang.String)faultExeptionClassNameMap
+                            .get(faultElt.getQName());
+                            java.lang.Class exceptionClass = java.lang.Class
+                            .forName(exceptionClassName);
+                            java.rmi.RemoteException ex = (java.rmi.RemoteException)exceptionClass
+                            .newInstance();
+                            // message class
+                            java.lang.String messageClassName = (java.lang.String)faultMessageMap
+                            .get(faultElt.getQName());
+                            java.lang.Class messageClass = java.lang.Class
+                            .forName(messageClassName);
+                            java.lang.Object messageObject = null;
+                            java.lang.reflect.Method m = exceptionClass.getMethod(
+                                "setFaultMessage",
+                                new java.lang.Class[] { messageClass });
+                            m.invoke(ex, new java.lang.Object[] { messageObject });
+    
+                            throw ex;
+                        } catch (java.lang.ClassCastException e) {
+                            // we cannot intantiate the class - throw the original
+                            // Axis fault
+                            throw f;
+                        } catch (java.lang.ClassNotFoundException e) {
+                            // we cannot intantiate the class - throw the original
+                            // Axis fault
+                            throw f;
+                        } catch (java.lang.NoSuchMethodException e) {
+                            // we cannot intantiate the class - throw the original
+                            // Axis fault
+                            throw f;
+                        } catch (java.lang.reflect.InvocationTargetException e) {
+                            // we cannot intantiate the class - throw the original
+                            // Axis fault
+                            throw f;
+                        } catch (java.lang.IllegalAccessException e) {
+                            // we cannot intantiate the class - throw the original
+                            // Axis fault
+                            throw f;
+                        } catch (java.lang.InstantiationException e) {
+                            // we cannot intantiate the class - throw the original
+                            // Axis fault
+                            throw f;
+                        }
+                    } else {
+                        throw f;
+                    }
+                } else {
+                    throw f;
+                }
+            }
+        }
+  </xsl:template>
+  
+  <!-- Invoked to get the operation index number for a method. -->
+  <xsl:template match="method" mode="get-index"><xsl:value-of select="position()-1"/></xsl:template>
+  
+  <!-- Invoked to get the operation action for a method. -->
+  <xsl:template match="method" mode="get-action"><xsl:value-of select="@action"/></xsl:template>
+  
+  <!-- Generate code for a particular parameter element in a client stub method -->
+  <xsl:template match="parameter-element" mode="interface-implementation">
+    <xsl:choose>
+      <xsl:when test="@array='true'">
+        <xsl:call-template name="marshal-array"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="marshal-value"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <!-- Marshal an array to a repeated element -->
+  <xsl:template name="marshal-array">
+    if (<xsl:value-of select="@java-name"/> == null || <xsl:value-of select="@java-name"/>.length == 0) {
+    <xsl:choose>
+      <xsl:when test="@optional='true'"></xsl:when>
+      <xsl:when test="@nillable='true'">
+        child = factory.createOMElement("<xsl:value-of select='@ns'/>", "<xsl:value-of select='@name'/>", "");
+        org.apache.axiom.om.OMNamespace xsins = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+        child.declareNamespace(xsins);
+        child.addAttribute("nil", "true", xsins);
+        wrapper.addChild(child);
+      </xsl:when>
+      <xsl:otherwise>
+        throw new org.apache.axis2.AxisFault("Missing required value <xsl:value-of select='@java-name'/>");
+      </xsl:otherwise>
+    </xsl:choose>
+    } else {
+        for (int i = 0; i &lt; <xsl:value-of select="@java-name"/>.length; i++) {
+            <xsl:value-of select="@java-type"/> _item = <xsl:value-of select="@java-name"/>[i];
+    <xsl:choose>
+      <xsl:when test="@object='true' and @nillable='true'">
+            if (_item == null) {
+                child = factory.createOMElement("<xsl:value-of select='@ns'/>", "<xsl:value-of select='@name'/>", "");
+                org.apache.axiom.om.OMNamespace xsins = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+                child.declareNamespace(xsins);
+                child.addAttribute("nil", "true", xsins);
+                wrapper.addChild(child);
+            } else {
+        <xsl:call-template name="serialize-value-to-child"/>
+            }
+      </xsl:when>
+      <xsl:when test="@object='true'">
+            if (_item == null) {
+                throw new org.apache.axis2.AxisFault("Null value in array <xsl:value-of select='@java-name'/>");
+            } else {
+        <xsl:call-template name="serialize-value-to-child"/>
+            }
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="serialize-value-to-child"/>
+      </xsl:otherwise>
+    </xsl:choose>
+        }
+    }
+  </xsl:template>
+  
+  <!-- Marshal a simple value to a non-repeated element -->
+  <xsl:template name="marshal-value">
+    <xsl:choose>
+      <xsl:when test="@object='true' and @nillable='true'">
+        if (<xsl:value-of select="@java-name"/> == null) {
+            child = factory.createOMElement("<xsl:value-of select='@ns'/>", "<xsl:value-of select='@name'/>", "");
+            org.apache.axiom.om.OMNamespace xsins = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+            child.declareNamespace(xsins);
+            child.addAttribute("nil", "true", xsins);
+            wrapper.addChild(child);
+        } else {
+        <xsl:call-template name="serialize-value-to-child"/>
+        }
+      </xsl:when>
+      <xsl:when test="@object='true'">
+        if (<xsl:value-of select="@java-name"/> == null) {
+            throw new org.apache.axis2.AxisFault("Null value for <xsl:value-of select='@java-name'/>");
+        } else {
+        <xsl:call-template name="serialize-value-to-child"/>
+        }
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="serialize-value-to-child"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <!-- Convert the current value to an element. -->
+  <xsl:template name="serialize-value-to-child">
+    <xsl:choose>
+      <xsl:when test="@java-type='java.lang.String' and @serializer=''">
+        child = factory.createOMElement("<xsl:value-of select='@ns'/>", "<xsl:value-of select='@name'/>", "");
+        child.setText(<xsl:call-template name="parameter-or-array-item"/>);
+      </xsl:when>
+      <xsl:when test="@form='simple' and @serializer=''">
+        child = factory.createOMElement("<xsl:value-of select='@ns'/>", "<xsl:value-of select='@name'/>", "");
+        child.setText(<xsl:call-template name="parameter-or-array-item"/>.toString());
+      </xsl:when>
+      <xsl:when test="@form='simple'">
+        child = factory.createOMElement("<xsl:value-of select='@ns'/>", "<xsl:value-of select='@name'/>", "");
+        child.setText(<xsl:value-of select="@serializer"/>(<xsl:call-template name="parameter-or-array-item"/>));
+      </xsl:when>
+      <xsl:when test="@form='complex'">
+        org.apache.axiom.om.OMDataSource src = new org.apache.axis2.jibx.JiBXDataSource(<xsl:call-template name="parameter-or-array-item"/>, _type_index<xsl:value-of select="@type-index"/>, bindingFactory);
+        org.apache.axiom.om.OMNamespace appns = factory.createOMNamespace("<xsl:value-of select='@ns'/>", "");
+        child.declareNamespace(appns);
+        child = factory.createOMElement(src, "<xsl:value-of select='@name'/>", appns);
+      </xsl:when>
+    </xsl:choose>
+        wrapper.addChild(child);
+  </xsl:template>
+  
+  <!-- Reference to parameter or array item value, as appropriate -->
+  <xsl:template name="parameter-or-array-item"><xsl:choose><xsl:when test="@array='true'">_item</xsl:when><xsl:otherwise><xsl:value-of select='@java-name'/></xsl:otherwise></xsl:choose></xsl:template>
+  
+  <!-- Generate code for the result in a client stub method -->
+  <xsl:template match="return-element" mode="interface-implementation">
+    <xsl:choose>
+      <xsl:when test="@array='true'">
+        <xsl:call-template name="unmarshal-array"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="unmarshal-value"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  
+  <!--
+  STATIC CODE GENERATION
+  -->
+  
+  <!-- Called by main template to handle static data structures. -->
+  <xsl:template match="initialize-binding">
+      private static final org.jibx.runtime.IBindingFactory bindingFactory;
+      private static final String bindingErrorMessage;
+    <xsl:apply-templates mode="generate-index-fields" select="abstract-type"/>
+      static {
+          org.jibx.runtime.IBindingFactory factory = null;
+          String message = null;
+          try {
+              factory = org.jibx.runtime.BindingDirectory.getFactory(<xsl:value-of select="@bound-class"/>.class);
+              message = null;
+          } catch (Exception e) { message = e.getMessage(); }
+          bindingFactory = factory;
+          bindingErrorMessage = message;
+    <xsl:apply-templates mode="set-index-fields" select="abstract-type"/>
+      };
+      
+      private static org.jibx.runtime.impl.UnmarshallingContext getNewUnmarshalContext(org.apache.axiom.om.OMElement param)
+          throws org.jibx.runtime.JiBXException {
+          if (bindingFactory == null) {
+              throw new RuntimeException(bindingErrorMessage);
+          }
+          org.jibx.runtime.impl.UnmarshallingContext ctx =
+              (org.jibx.runtime.impl.UnmarshallingContext)bindingFactory.createUnmarshallingContext();
+          org.jibx.runtime.IXMLReader reader = new org.jibx.runtime.impl.StAXReaderWrapper(param.getXMLStreamReaderWithoutCaching(), "SOAP-message", true);
+          ctx.setDocument(reader);
+          return ctx;
+      }
+  </xsl:template>
+  
+  <!-- Called by "initialize-binding" template to generate mapped class index fields. -->
+  <xsl:template match="abstract-type" mode="generate-index-fields">
+          private static final int _type_index<xsl:value-of select="@type-index"/>;
+  </xsl:template>
+    
+  <!-- Called by "initialize-binding" template to initialize mapped class index fields. -->
+  <xsl:template match="abstract-type" mode="set-index-fields">
+         _type_index<xsl:value-of select="@type-index"/> = (bindingFactory == null) ?
+            -1 : bindingFactory.getTypeIndex("{<xsl:value-of select="@ns"/>}<xsl:value-of select="@name"/>");
+  </xsl:template>
+  
+  
+  <!--
+  SHARED TEMPLATES
+  -->
+  
   <!-- Unmarshal a repeated element into an array -->
   <xsl:template name="unmarshal-array">
     <xsl:value-of select="@java-type"/>[] <xsl:value-of select="@java-name"/> = new <xsl:value-of select="@java-type"/>[4];
@@ -260,7 +585,7 @@
       <xsl:value-of select="@java-name"/> = (<xsl:value-of select="@java-type"/>[])org.jibx.runtime.Utility.resizeArray(index, <xsl:value-of select="@java-name"/>);
     <xsl:if test="@optional!='true'">
       if (index == 0) {
-          throw new org.apache.axis2.AxisFault("Receive message is missing required element {<xsl:value-of select='@ns'/>}<xsl:value-of select='@name'/>");
+          throw new org.apache.axis2.AxisFault("Missing required element {<xsl:value-of select='@ns'/>}<xsl:value-of select='@name'/>");
       }
     </xsl:if>
   </xsl:template>
@@ -284,7 +609,7 @@
       </xsl:when>
       <xsl:otherwise>
           } else {
-              throw new org.apache.axis2.AxisFault("Receive message is missing required element {<xsl:value-of select='@ns'/>}<xsl:value-of select='@name'/>");
+              throw new org.apache.axis2.AxisFault("Missing required element {<xsl:value-of select='@ns'/>}<xsl:value-of select='@name'/>");
           }
       </xsl:otherwise>
     </xsl:choose>
@@ -303,63 +628,9 @@
         <xsl:value-of select="@deserializer"/>(uctx.parseElementText("<xsl:value-of select="@ns"/>", "<xsl:value-of select="@name"/>"))
       </xsl:when>
       <xsl:when test="@form='complex'">
-        uctx.getUnmarshaller(_type_index<xsl:value-of select="@type-index"/>).unmarshal(null, ctx)
+        uctx.getUnmarshaller(_type_index<xsl:value-of select="@type-index"/>).unmarshal(null, uctx)
       </xsl:when>
     </xsl:choose>
-  </xsl:template>
-  
-  <xsl:template match="dbmethod" mode="interface-implementation">
-    <xsl:variable name="return-base-type"><xsl:value-of select="out-wrapper/return-element/@java-type"/></xsl:variable>
-    <xsl:variable name="return-full-type"><xsl:value-of select="$return-base-type"/><xsl:if test="out-wrapper/return-element/@array='true'">[]</xsl:if></xsl:variable>
-      public <xsl:value-of select="$return-full-type"/><xsl:text> </xsl:text><xsl:value-of select="@method-name"/>() {
-          
-      }
-  </xsl:template>
-  
-  <!-- Generate the method parameter list declaration -->
-  <xsl:template match="in-wrapper" mode="parameter-list">
-    (<xsl:for-each select="parameter-element"><xsl:if test="position()&gt;1">, </xsl:if><xsl:value-of select="@fulltype"/> <xsl:value-of select="@name"/></xsl:for-each>
-  </xsl:template>
-  
-  <!-- Called by main template to handle static data structures. -->
-  <xsl:template match="initialize-binding">
-      private static final org.jibx.runtime.IBindingFactory bindingFactory;
-      private static final String bindingErrorMessage;
-    <xsl:apply-templates mode="generate-index-fields" select="abstract-type"/>
-      static {
-          org.jibx.runtime.IBindingFactory factory = null;
-          String message = null;
-          try {
-              factory = org.jibx.runtime.BindingDirectory.getFactory(<xsl:value-of select="@bound-class"/>.class);
-              message = null;
-          } catch (Exception e) { message = e.getMessage(); }
-          bindingFactory = factory;
-          bindingErrorMessage = message;
-    <xsl:apply-templates mode="set-index-fields" select="abstract-type"/>
-      };
-      
-      private static org.jibx.runtime.impl.UnmarshallingContext getNewUnmarshalContext(org.apache.axiom.om.OMElement param)
-          throws org.jibx.runtime.JiBXException {
-          if (bindingFactory == null) {
-              throw new RuntimeException(bindingErrorMessage);
-          }
-          org.jibx.runtime.impl.UnmarshallingContext ctx =
-              (org.jibx.runtime.impl.UnmarshallingContext)bindingFactory.createUnmarshallingContext();
-          org.jibx.runtime.IXMLReader reader = new org.jibx.runtime.impl.StAXReaderWrapper(param.getXMLStreamReaderWithoutCaching(), "SOAP-message", true);
-          ctx.setDocument(reader);
-          return ctx;
-      }
-  </xsl:template>
-  
-  <!-- Called by "initialize-binding" template to generate mapped class index fields. -->
-  <xsl:template match="abstract-type" mode="generate-index-fields">
-          private static final int _type_index<xsl:value-of select="@type-index"/>;
-  </xsl:template>
-    
-  <!-- Called by "initialize-binding" template to initialize mapped class index fields. -->
-  <xsl:template match="abstract-type" mode="set-index-fields">
-         _type_index<xsl:value-of select="@type-index"/> = (bindingFactory == null) ?
-            -1 : bindingFactory.getTypeIndex("{<xsl:value-of select="@ns"/>}<xsl:value-of select="@name"/>");
   </xsl:template>
   
 </xsl:stylesheet>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org