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/06/29 13:24:26 UTC

svn commit: r202346 - in /webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl: codegen/emitter/MultiLanguageClientEmitter.java template/java/InterfaceImplementationTemplate.xsl template/java/XMLBeansSupporterTemplate.xsl

Author: ajith
Date: Wed Jun 29 04:24:22 2005
New Revision: 202346

URL: http://svn.apache.org/viewcvs?rev=202346&view=rev
Log:
making some minor changes to make the Databinding supporters static

Modified:
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=202346&r1=202345&r2=202346&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java Wed Jun 29 04:24:22 2005
@@ -648,6 +648,7 @@
      */
     protected XmlDocument createDOMDocuementForInterfaceImplementation(WSDLBinding binding, WSDLService service) {
         WSDLInterface boundInterface = binding.getBoundInterface();
+
         WSDLEndpoint endpoint = null;
         HashMap endpoints = service.getEndpoints();
         XmlDocument doc = new XmlDocument();
@@ -662,17 +663,17 @@
         addAttribute(doc,"dbsupportpackage",configuration.getPackageName()+DATABINDING_PACKAGE_NAME_SUFFIX,rootElement);
         addEndpoints(doc,rootElement,endpoints);
         fillSyncAttributes(doc, rootElement);
-        loadOperations(boundInterface, doc, rootElement);
+        loadOperations(boundInterface, doc, rootElement,binding);
         doc.appendChild(rootElement);
 
-        //////////////////////////
-//        try {
-//            doc.write(System.out);
-//        } catch (IOException e) {
-//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-//        }
-
-        ///////////////////////////////
+//        //////////////////////////
+        try {
+            doc.write(System.out);
+        } catch (IOException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+//
+//        ///////////////////////////////
 
 
         return doc;

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=202346&r1=202345&r2=202346&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl Wed Jun 29 04:24:22 2005
@@ -41,7 +41,7 @@
            this.toEPR = new org.apache.axis.addressing.EndpointReference(org.apache.axis.addressing.AddressingConstants.WSA_TO,targetEndpoint);
 		    //creating the configuration
            _configurationContext = new org.apache.axis.context.ConfigurationContextFactory().buildClientConfigurationContext(axis2Home);
-            _configurationContext.getAxisConfiguration().addService(_service);
+           _configurationContext.getAxisConfiguration().addService(_service);
            _serviceContext = _configurationContext.createServiceContext(_service.getName());
 
 	    }
@@ -62,6 +62,7 @@
          <xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable>  <!-- this needs to change-->
          <xsl:variable name="dbsupportclassname"><xsl:value-of select="@dbsupportname"></xsl:value-of></xsl:variable>  
          <xsl:variable name="soapAction"><xsl:value-of select="@soapaction"></xsl:value-of></xsl:variable>
+         <xsl:variable name="fullsupporterclassname"><xsl:value-of select="$dbpackage"/>.<xsl:value-of select="$dbsupportclassname"/></xsl:variable>
 
          <!-- When genrating code, the MEP should be taken into account    -->
 
@@ -75,14 +76,10 @@
 
 		    org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_serviceContext);
  		    org.apache.axis.context.MessageContext _messageContext = getMessageContext();
-            _call.setTo(toEPR); 
+            _call.setTo(toEPR);
             org.apache.axis.soap.SOAPEnvelope env = null;
             env = createEnvelope();
-              //create a databinder
-            <xsl:variable name="fullsupporterclassname"><xsl:value-of select="$dbpackage"/>.<xsl:value-of select="$dbsupportclassname"/></xsl:variable>
-            <xsl:value-of select="$fullsupporterclassname"/> databindSupporter = new <xsl:value-of select="$fullsupporterclassname"/>();
-
-             <xsl:choose>
+            <xsl:choose>
               <xsl:when test="$inputtype!=''">
                   <xsl:choose>
 
@@ -97,7 +94,7 @@
 
                       <xsl:when test="$style='doc'">
                        //Style is Doc
-                       setValueDoc(env,databindSupporter.toOM(<xsl:value-of select="$inputparam"/>));
+                       setValueDoc(env,<xsl:value-of select="$fullsupporterclassname"/>.toOM(<xsl:value-of select="$inputparam"/>));
                       </xsl:when>
                       <xsl:otherwise>
                        //Unknown style!! No code is generated
@@ -137,7 +134,7 @@
               <xsl:otherwise>
              org.apache.axis.context.MessageContext  _returnMessageContext = _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
              org.apache.axis.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
-             java.lang.Object object = databindSupporter.fromOM(getElement(_returnEnv,"<xsl:value-of select="$style"/>"),<xsl:value-of select="$outputtype"/>.class);
+             java.lang.Object object = <xsl:value-of select="$fullsupporterclassname"/>.fromOM(getElement(_returnEnv,"<xsl:value-of select="$style"/>"),<xsl:value-of select="$outputtype"/>.class);
              return (<xsl:value-of select="$outputtype"/>)object;
                  </xsl:otherwise>
              </xsl:choose>
@@ -169,8 +166,8 @@
                       </xsl:when>
                       <!-- The follwing code is specific to XML beans-->
                       <xsl:when test="$style='doc'">
-                       //Style is Doc
-                       setValueDoc(env,getElementFromReader(<xsl:value-of select="$inputparam"/>.newXMLStreamReader()));
+                         //Style is Doc
+                       setValueDoc(env,<xsl:value-of select="$fullsupporterclassname"/>.toOM(<xsl:value-of select="$inputparam"/>));
                       </xsl:when>
                       <xsl:otherwise>
                           //Unknown style!! No code is generated

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl?rev=202346&r1=202345&r2=202346&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl Wed Jun 29 04:24:22 2005
@@ -10,7 +10,7 @@
     public class <xsl:value-of select="@name"/> {
              <xsl:apply-templates />
 
-          public org.apache.xmlbeans.XmlObject fromOM(org.apache.axis.om.OMElement param,
+          public static org.apache.xmlbeans.XmlObject fromOM(org.apache.axis.om.OMElement param,
                java.lang.Class type){
                 try{
                     <xsl:for-each select="param">
@@ -21,14 +21,14 @@
                      </xsl:if>
                     </xsl:for-each>
                  }catch(java.lang.Exception e){
-                    e.printStackTrace();
+                    throw new RuntimeException("Data binding error",e);
                 }
              return null;
           }
 
         //Generates an empty object for testing
-        // Caution - may need some manual editing to wrk properly
-         public org.apache.xmlbeans.XmlObject getTestObject(java.lang.Class type){
+        // Caution - need some manual editing to work properly
+         public static org.apache.xmlbeans.XmlObject getTestObject(java.lang.Class type){
                 try{
                    <xsl:for-each select="param">
                     <xsl:if test="@type!=''">
@@ -43,7 +43,7 @@
                      </xsl:if>
                     </xsl:for-each>
                  }catch(java.lang.Exception e){
-                    e.printStackTrace();
+                   throw new RuntimeException("Test object creation failure",e);
                 }
              return null;
           }
@@ -52,7 +52,7 @@
     
     <xsl:template match="param">
         <xsl:if test="@type!=''">
-          public  org.apache.axis.om.OMElement  toOM(<xsl:value-of select="@type"/> param){
+          public  static org.apache.axis.om.OMElement  toOM(<xsl:value-of select="@type"/> param){
 		    org.apache.axis.om.impl.llom.builder.StAXOMBuilder builder = org.apache.axis.om.impl.llom.factory.OMXMLBuilderFactory.createStAXOMBuilder
             (org.apache.axis.om.OMAbstractFactory.getOMFactory(),new org.apache.axis.clientapi.StreamWrapper(param.newXMLStreamReader())) ;
 		    org.apache.axis.om.OMElement documentElement = builder.getDocumentElement();