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 ke...@apache.org on 2007/11/23 16:29:55 UTC

svn commit: r597686 - in /webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description: AxisService2WSDL20.java WSDL2Constants.java

Author: keithc
Date: Fri Nov 23 07:29:51 2007
New Revision: 597686

URL: http://svn.apache.org/viewvc?rev=597686&view=rev
Log:
Fixing Axis2-3182


Modified:
    webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
    webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java

Modified: webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java?rev=597686&r1=597685&r2=597686&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java (original)
+++ webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java Fri Nov 23 07:29:51 2007
@@ -106,6 +106,7 @@
         OMNamespace wsoap;
         OMNamespace whttp;
         OMNamespace wsdlx;
+        OMNamespace wrpc;
 
         OMNamespace tns = omFactory
                 .createOMNamespace(axisService.getTargetNamespace(),
@@ -140,6 +141,15 @@
             wsdlx = descriptionElement.declareNamespace(WSDL2Constants.URI_WSDL2_EXTENSIONS,
                                                         WSDL2Constants.WSDL_EXTENTION_PREFIX);
         }
+        if (nameSpacesMap != null && nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_RPC)) {
+            wrpc = omFactory
+                    .createOMNamespace(WSDL2Constants.URI_WSDL2_RPC,
+                                       WSDLSerializationUtil.getPrefix(
+                                               WSDL2Constants.URI_WSDL2_RPC, nameSpacesMap));
+        } else {
+            wrpc = descriptionElement.declareNamespace(WSDL2Constants.URI_WSDL2_RPC,
+                                                        WSDL2Constants.WSDL_RPC_PREFIX);
+        }
 
         // Add the documentation element
         WSDLSerializationUtil.addWSDLDocumentationElement(axisService, descriptionElement, omFactory, wsdl);
@@ -178,7 +188,8 @@
         }
 
         // Add the interface element
-        descriptionElement.addChild(getInterfaceElement(wsdl, tns, wsdlx, omFactory, interfaceName));
+        descriptionElement.addChild(getInterfaceElement(wsdl, tns, wsdlx, wrpc, omFactory,
+                                                        interfaceName));
 
         boolean disableREST = false;
         Parameter disableRESTParameter =
@@ -284,7 +295,7 @@
      * @return The generated interface element
      */
     private OMElement getInterfaceElement(OMNamespace wsdl, OMNamespace tns, OMNamespace wsdlx,
-                                          OMFactory fac, String interfaceName)
+                                          OMNamespace wrpc, OMFactory fac, String interfaceName)
             throws URISyntaxException, AxisFault {
 
         OMElement interfaceElement = fac.createOMElement(WSDL2Constants.INTERFACE_LOCAL_NAME, wsdl);
@@ -299,7 +310,8 @@
             if (axisOperation.isControlOperation()) {
                 continue;
             }
-            interfaceOperations.add(i, generateInterfaceOperationElement(axisOperation, wsdl, tns, wsdlx));
+            interfaceOperations.add(i, generateInterfaceOperationElement(axisOperation, wsdl, tns,
+                                                                         wsdlx, wrpc));
             i++;
             Iterator faultsIterator = axisOperation.getFaultMessages().iterator();
             while (faultsIterator.hasNext()) {
@@ -361,7 +373,8 @@
     public OMElement generateInterfaceOperationElement(AxisOperation axisOperation,
                                                        OMNamespace wsdl,
                                                        OMNamespace tns,
-                                                       OMNamespace wsdlx) throws
+                                                       OMNamespace wsdlx,
+                                                       OMNamespace wrpc) throws
             URISyntaxException, AxisFault {
         OMFactory omFactory = OMAbstractFactory.getOMFactory();
         OMElement axisOperationElement =
@@ -386,6 +399,12 @@
             }
             axisOperationElement.addAttribute(
                     omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_STYLE, null, style));
+            if (style.indexOf(WSDL2Constants.STYLE_RPC) >= 0) {
+                axisOperationElement.addAttribute(
+                    omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_SIGNATURE, wrpc,
+                                                (String) axisOperation.getParameterValue(
+                                                        WSDL2Constants.ATTR_WRPC_SIGNATURE)));
+            }
         }
         axisOperationElement.addAttribute(omFactory.createOMAttribute(
                 WSDL2Constants.ATTRIBUTE_NAME_PATTERN, null, axisOperation.getMessageExchangePattern()));
@@ -449,7 +468,7 @@
      * @param axisOperation - The axisOperation that needs to be checked
      * @return String [] - An array of styles that the operation adheres to.
      */
-    private URI [] checkStyle(AxisOperation axisOperation) throws URISyntaxException {
+    private URI [] checkStyle(AxisOperation axisOperation) throws URISyntaxException, AxisFault {
         boolean isRPC = true;
         boolean isMultipart = true;
         boolean isIRI = true;
@@ -531,8 +550,10 @@
         } else {
             return new URI [0];
         }
+        AxisMessage outMessage = null;
+        Map outMessageElementDetails = new HashMap();                                    
         if (isRPC && !WSDL2Constants.MEP_URI_IN_ONLY.equals(mep)) {
-            AxisMessage outMessage = axisOperation.getMessage(WSDL2Constants.MESSAGE_LABEL_OUT);
+            outMessage = axisOperation.getMessage(WSDL2Constants.MESSAGE_LABEL_OUT);
             QName qName = outMessage.getElementQName();
             if (qName == null && Constants.XSD_ANY.equals(qName)) {
                 isRPC = false;
@@ -557,7 +578,6 @@
                                 xmlSchemaSequence.getItems();
                         if (schemaObjectCollection != null) {
                             Iterator iterator = schemaObjectCollection.getIterator();
-                            Map outMessageElementDetails = new HashMap();
                             while (iterator.hasNext()) {
                                 Object next = iterator.next();
                                 if (!(next instanceof XmlSchemaElement)) {
@@ -594,6 +614,7 @@
         int count = 0;
         if (isRPC) {
             styles.add(new URI(WSDL2Constants.STYLE_RPC));
+            axisOperation.addParameter(WSDL2Constants.ATTR_WRPC_SIGNATURE, generateRPCSignature(inMessageElementDetails,  outMessageElementDetails));
             count ++;
         }
         if (isIRI) {
@@ -605,5 +626,30 @@
             count ++;
         }
         return (URI[]) styles.toArray(new URI[count]);
+    }
+
+    private String generateRPCSignature(Map inMessageElementDetails, Map outMessageElementDetails) {
+        String in = "";
+        String out = "";
+        String inOut = "";
+        Set inElementSet = inMessageElementDetails.keySet();
+        Set outElementSet = outMessageElementDetails.keySet();
+
+        Iterator inElementIterator = inElementSet.iterator();
+        while (inElementIterator.hasNext()) {
+            String inElementName = (String) inElementIterator.next();
+            if (outElementSet.contains(inElementName)) {
+                inOut = inOut + inElementName + " " + WSDL2Constants.RPC_INOUT + " ";
+                outElementSet.remove(inElementName);
+            } else {
+                in = in + inElementName + " " + WSDL2Constants.RPC_IN + " ";
+            }
+        }
+        Iterator outElementIterator = outElementSet.iterator();
+        while (outElementIterator.hasNext()) {
+            String outElementName = (String) outElementIterator.next();
+            out = out + outElementName + " " + WSDL2Constants.RPC_OUT + " ";
+        }
+        return in + out + inOut;
     }
 }

Modified: webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java?rev=597686&r1=597685&r2=597686&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java (original)
+++ webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java Fri Nov 23 07:29:51 2007
@@ -26,9 +26,11 @@
     String URI_WSDL2_SOAP = "http://www.w3.org/ns/wsdl/soap";
     String URI_WSDL2_HTTP = "http://www.w3.org/ns/wsdl/http";
     String URI_WSDL2_EXTENSIONS = "http://www.w3.org/ns/wsdl-extensions";
+    String URI_WSDL2_RPC = "http://www.w3.org/ns/wsdl/rpc";
     String SOAP_PREFIX = "wsoap";
     String HTTP_PREFIX = "whttp";
     String WSDL_EXTENTION_PREFIX = "wsdlx";
+    String WSDL_RPC_PREFIX = "wrpc";
     String SOAP_ENV_PREFIX = "soap";
     String DEFAULT_TARGET_NAMESPACE_PREFIX = "axis2";
     String DOCUMENTATION = "documentation";
@@ -73,6 +75,7 @@
     String ATTRIBUTE_AUTHENTICATION_TYPE = "authenticationType";
     String ATTRIBUTE_AUTHENTICATION_REALM = "authenticationRealm";
     String ATTRIBUTE_STYLE = "style";
+    String ATTRIBUTE_SIGNATURE = "signature";
     String OPERATION_STYLE = "operationStyle";
     String IN_PUT_LOCAL_NAME = "input";
     String OUT_PUT_LOCAL_NAME = "output";
@@ -116,11 +119,17 @@
 
     String ATTR_WSDLX_SAFE = "wsdlx:safe";
 
+    String ATTR_WRPC_SIGNATURE = "wrpc:signature";
+
     String SOAP_VERSION_1_1 = "1.1";
     String SOAP_VERSION_1_2 = "1.2";
 
     String MESSAGE_LABEL_IN = "In";
     String MESSAGE_LABEL_OUT = "Out";
+
+    String RPC_IN = "#in";
+    String RPC_OUT = "#out";
+    String RPC_INOUT = "#inout";
 
     String HTTP_LOCATION_TABLE = "HTTPLocationTable";
 



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