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/11/22 20:10:02 UTC

svn commit: r348216 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/rpc/client/ codegen/src/org/apache/axis2/wsdl/template/java/ core/src/org/apache/axis2/client/ core/src/org/apache/axis2/rpc/ core/src/org/apache/axis2/rpc/cli...

Author: dims
Date: Tue Nov 22 11:09:32 2005
New Revision: 348216

URL: http://svn.apache.org/viewcvs?rev=348216&view=rev
Log:
Move setValueRPC out from org.apache.axis2.client.Stub to org.apache.axis2.rpc.client.RPCStub

TODO: Make this method non-static and fix the xsl's that generate code to "extend" RPCStub when appropriate.


Added:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCStub.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/rpc/
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/rpc/client/
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/rpc/client/StubSupporter.java   (contents, props changed)
      - copied, changed from r348075, webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/StubSupporter.java
Removed:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/StubSupporter.java
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCCall.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCCall.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCCall.java?rev=348216&r1=348215&r2=348216&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCCall.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCCall.java Tue Nov 22 11:09:32 2005
@@ -12,8 +12,6 @@
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-*
-* @author : Deepal Jayasinghe (deepal@apache.org)
 */
 
 package org.apache.axis2.rpc.client;

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCStub.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCStub.java?rev=348216&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCStub.java (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCStub.java Tue Nov 22 11:09:32 2005
@@ -0,0 +1,61 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.rpc.client;
+
+import org.apache.axis2.client.Stub;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPEnvelope;
+
+public class RPCStub extends Stub {
+    /**
+     * TODO: Make this method non-static and fix the xsl's that generate code to "extend" RPCStub when appropriate.
+     * 
+     * @param factory
+     * @param env
+     * @param methodNamespaceURI
+     * @param methodName
+     * @param paramNames
+     * @param values
+     */
+    public static void setValueRPC(OMFactory factory,
+                               SOAPEnvelope env,
+                               String methodNamespaceURI,
+                               String methodName,
+                               String[] paramNames,
+                               Object[] values) {
+        SOAPBody body = env.getBody();
+
+        OMNamespace methodNamespace = factory.createOMNamespace(methodNamespaceURI,
+                "ns1");
+        OMElement elt = factory.createOMElement(methodName, methodNamespace);
+        if (paramNames != null) {
+            //find the relevant object here, convert it and add it to the elt
+            for (int i = 0; i < paramNames.length; i++) {
+                String paramName = paramNames[i];
+                Object value = values[i];
+                elt.addChild(StubSupporter.createRPCMappedElement(paramName,
+                        factory.createOMNamespace("", null), //empty namespace
+                        value,
+                        factory));
+            }
+        }
+        body.addChild(elt);
+    }
+}

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=348216&r1=348215&r2=348216&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 Tue Nov 22 11:09:32 2005
@@ -138,7 +138,7 @@
                   <xsl:choose>
                       <xsl:when test="$style='rpc'">
                // Style is RPC
-              setValueRPC(env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
+              org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(this.soapVersion), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
               new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
               new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
                       </xsl:when>
@@ -163,7 +163,7 @@
                    <xsl:choose>
                    <xsl:when test="$style='rpc'">
                //Style is RPC. No input parameters
-               setValueRPC(env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
+               org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(this.soapVersion), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
                       </xsl:when>
                      <xsl:when test="$style='doc'">
                //Style is Doc. No input parameters
@@ -228,7 +228,7 @@
               <xsl:choose>
                <xsl:when test="$style='rpc'">
            // Style is RPC
-           setValueRPC(env,
+           org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(this.soapVersion), env,
             "<xsl:value-of select="@namespace"/>",
             "<xsl:value-of select="@name"/>",
              new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
@@ -249,7 +249,7 @@
                    <xsl:choose>
                    <xsl:when test="$style='rpc'">
            //Style is RPC. No input parameters
-              setValueRPC(env,
+              org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(this.soapVersion), env,
                 "<xsl:value-of select="@namespace"/>",
                 "<xsl:value-of select="@name"/>",
                 null,
@@ -317,7 +317,7 @@
                   <xsl:choose>
                       <xsl:when test="$style='rpc'">
                // Style is RPC
-              setValueRPC(env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
+              org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(this.soapVersion), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
               new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
               new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
                       </xsl:when>
@@ -337,7 +337,7 @@
                    <xsl:choose>
                    <xsl:when test="$style='rpc'">
                //Style is RPC. No input parameters
-               setValueRPC(env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
+               org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(this.soapVersion), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
                       </xsl:when>
                      <xsl:when test="$style='doc'">
                //Style is Doc. No input parameters

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java?rev=348216&r1=348215&r2=348216&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java Tue Nov 22 11:09:32 2005
@@ -18,6 +18,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.rpc.client.StubSupporter;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
@@ -172,32 +173,6 @@
         return getFactory(this.soapVersion).getDefaultEnvelope();
     }
 
-    protected void setValueRPC(SOAPEnvelope env,
-                               String methodNamespaceURI,
-                               String methodName,
-                               String[] paramNames,
-                               Object[] values) {
-        SOAPBody body = env.getBody();
-        OMFactory fac = this.getFactory(this.soapVersion);
-
-        OMNamespace methodNamespace = fac.createOMNamespace(methodNamespaceURI,
-                "ns1");
-        OMElement elt = fac.createOMElement(methodName, methodNamespace);
-        if (paramNames != null) {
-            //find the relevant object here, convert it and add it to the elt
-            for (int i = 0; i < paramNames.length; i++) {
-                String paramName = paramNames[i];
-                Object value = values[i];
-                elt.addChild(StubSupporter.createRPCMappedElement(paramName,
-                        fac.createOMNamespace("", null), //empty namespace
-                        value,
-                        fac));
-            }
-        }
-        body.addChild(elt);
-    }
-
-
     protected OMElement getElementFromReader(XMLStreamReader reader) {
         StAXOMBuilder builder = OMXMLBuilderFactory.createStAXOMBuilder(
                 OMAbstractFactory.getOMFactory(), reader);
@@ -251,7 +226,7 @@
     }
 
 
-    private SOAPFactory getFactory(int soapVersion) {
+    protected SOAPFactory getFactory(int soapVersion) {
         if (soapVersion==SOAP_11){
             return OMAbstractFactory.getSOAP11Factory();
         }else if (soapVersion==SOAP_12){

Copied: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/rpc/client/StubSupporter.java (from r348075, webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/StubSupporter.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/rpc/client/StubSupporter.java?p2=webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/rpc/client/StubSupporter.java&p1=webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/StubSupporter.java&r1=348075&r2=348216&rev=348216&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/StubSupporter.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/rpc/client/StubSupporter.java Tue Nov 22 11:09:32 2005
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.apache.axis2.client;
+package org.apache.axis2.rpc.client;
 
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMFactory;

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/rpc/client/StubSupporter.java
------------------------------------------------------------------------------
    svn:eol-style = native