axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r545499 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description: AxisOperation.java AxisService2WSDL20.java
Date Fri, 08 Jun 2007 13:11:22 GMT
Author: dims
Date: Fri Jun  8 06:11:21 2007
New Revision: 545499

URL: http://svn.apache.org/viewvc?view=rev&rev=545499
Log:
Move WSDL20 specific code out from AxisOperation. Does not belong there

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java?view=diff&rev=545499&r1=545498&r2=545499
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
Fri Jun  8 06:11:21 2007
@@ -634,81 +634,4 @@
         }
         return false;
     }
-
-    /**
-     * Generates the interface Operation element. As with the binding operations we dont
need to
-     * ask AxisMessage to serialize its message cause AxisMessage does not have specific
properties
-     * as bindings.
-     * @param tns - The targetnamespace
-     * @param wsdlx - The WSDL extentions namespace (WSDL 2.0)
-     * @return The generated binding element
-     */
-    public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace wsdlx) {
-        OMFactory omFactory = OMAbstractFactory.getOMFactory();
-        OMElement axisOperationElement =
-                omFactory.createOMElement(WSDL2Constants.OPERATION_LOCAL_NAME, wsdl);
-        WSDLSerializationUtil.addWSDLDocumentationElement(this, axisOperationElement, omFactory,
wsdl);
-        axisOperationElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME,
-                                                                      null,
-                                                                      this.getName().getLocalPart()));
-        URI [] opStyle = (URI[]) this.getParameterValue(WSDL2Constants.OPERATION_STYLE);
-        if (opStyle != null && opStyle.length > 0) {
-            String style = opStyle[0].toString();
-            for (int i = 1; i < opStyle.length; i++) {
-                URI uri = opStyle[i];
-                style = style + " " + uri;
-            }
-            axisOperationElement.addAttribute(
-                    omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_STYLE, null, style));
-        }
-        axisOperationElement.addAttribute(omFactory.createOMAttribute(
-                WSDL2Constants.ATTRIBUTE_NAME_PATTERN, null, this.getMessageExchangePattern()));
-        Parameter param = this.getParameter(WSDL2Constants.ATTR_WSDLX_SAFE);
-        if (param != null) {
-            axisOperationElement.addAttribute(omFactory.createOMAttribute(
-                    WSDL2Constants.ATTRIBUTE_SAFE, wsdlx, (param.getValue()).toString()));
-        }
-        AxisService axisService = (AxisService) this.getParent();
-        Map nameSpaceMap = axisService.getNameSpacesMap();
-
-        // Add the input element
-        AxisMessage inMessage = (AxisMessage) getChild(WSDLConstants.WSDL_MESSAGE_IN_MESSAGE);
-        if (inMessage != null) {
-            OMElement inMessageElement = omFactory.createOMElement(WSDL2Constants.IN_PUT_LOCAL_NAME,
wsdl);
-            inMessageElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ELEMENT,
null, WSDLSerializationUtil.getElementName(inMessage, nameSpaceMap)));
-            WSDLSerializationUtil.addWSAWActionAttribute(inMessageElement, getInputAction());
-            WSDLSerializationUtil.addWSDLDocumentationElement(inMessage, inMessageElement,
omFactory, wsdl);
-            axisOperationElement.addChild(inMessageElement);
-        }
-
-        // Add the output element
-        AxisMessage outMessage = (AxisMessage) getChild(WSDLConstants.WSDL_MESSAGE_OUT_MESSAGE);
-        if (outMessage != null) {
-            OMElement outMessageElement = omFactory.createOMElement(WSDL2Constants.OUT_PUT_LOCAL_NAME,
wsdl);
-            outMessageElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ELEMENT,
null, WSDLSerializationUtil.getElementName(outMessage, nameSpaceMap)));
-            WSDLSerializationUtil.addWSAWActionAttribute(outMessageElement, getOutputAction());
-            WSDLSerializationUtil.addWSDLDocumentationElement(outMessage, outMessageElement,
omFactory, wsdl);
-            axisOperationElement.addChild(outMessageElement);
-        }
-
-        // Add the fault element
-        ArrayList faults = getFaultMessages();
-        if (faults != null) {
-            Iterator iterator = faults.iterator();
-            while (iterator.hasNext()) {
-                AxisMessage faultMessage = (AxisMessage) iterator.next();
-                OMElement faultElement;
-                if (WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.equals(faultMessage.getDirection()))
{
-                    faultElement = omFactory.createOMElement(WSDL2Constants.IN_FAULT_LOCAL_NAME,
wsdl);
-                } else {
-                    faultElement = omFactory.createOMElement(WSDL2Constants.OUT_FAULT_LOCAL_NAME,
wsdl);
-                }
-                faultElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_REF,
null, tns.getPrefix() + ":" + faultMessage.getName()));
-                WSDLSerializationUtil.addWSAWActionAttribute(faultElement, getFaultAction(faultMessage.getName()));
-                WSDLSerializationUtil.addWSDLDocumentationElement(faultMessage, faultElement,
omFactory, wsdl);
-                axisOperationElement.addChild(faultElement);
-            }
-        }
-        return axisOperationElement;
-    }
  }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java?view=diff&rev=545499&r1=545498&r2=545499
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
Fri Jun  8 06:11:21 2007
@@ -10,6 +10,7 @@
 import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.util.WSDLSerializationUtil;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.ws.commons.schema.XmlSchema;
 
 import javax.xml.stream.XMLStreamException;
@@ -17,13 +18,12 @@
 import javax.xml.namespace.QName;
 import java.io.ByteArrayInputStream;
 import java.io.StringWriter;
-import java.io.OutputStream;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import java.util.HashSet;
+import java.net.URI;
 
 public class AxisService2WSDL20 implements WSDL2Constants {
 
@@ -159,7 +159,7 @@
         }
 
         // Add the interface element
-        descriptionElement.addChild(getInterfaceEmelent(wsdl, tns, wsdlx, omFactory, interfaceName));
+        descriptionElement.addChild(getInterfaceElement(wsdl, tns, wsdlx, omFactory, interfaceName));
 
         // Check whether the axisService has any endpoints. If they exists serialize them
else
         // generate default endpoint elements.
@@ -247,7 +247,7 @@
      * @param interfaceName - The name of the interface
      * @return - The generated interface element
      */
-    private OMElement getInterfaceEmelent(OMNamespace wsdl, OMNamespace tns, OMNamespace
wsdlx,
+    private OMElement getInterfaceElement(OMNamespace wsdl, OMNamespace tns, OMNamespace
wsdlx,
                                           OMFactory fac, String interfaceName) {
 
         OMElement interfaceElement = fac.createOMElement(WSDL2Constants.INTERFACE_LOCAL_NAME,
wsdl);
@@ -259,7 +259,7 @@
         int i = 0;
         while (iterator.hasNext()) {
             AxisOperation axisOperation = (AxisOperation) iterator.next();
-            interfaceOperations.add(i, axisOperation.toWSDL20(wsdl, tns, wsdlx));
+            interfaceOperations.add(i, generateInterfaceOperationElement(axisOperation, wsdl,
tns, wsdlx));
             i++;
             Iterator faultsIterator = axisOperation.getFaultMessages().iterator();
             while (faultsIterator.hasNext()) {
@@ -304,5 +304,82 @@
                                                                 null, tns.getPrefix() + ":"
+
                 interfaceName));
         return serviceElement;
+    }
+
+    /**
+     * Generates the interface Operation element. As with the binding operations we dont
need to
+     * ask AxisMessage to serialize its message cause AxisMessage does not have specific
properties
+     * as bindings.
+     * @param tns - The targetnamespace
+     * @param wsdlx - The WSDL extentions namespace (WSDL 2.0)
+     * @return The generated binding element
+     */
+    public OMElement generateInterfaceOperationElement(AxisOperation axisOperation, OMNamespace
wsdl, OMNamespace tns, OMNamespace wsdlx) {
+        OMFactory omFactory = OMAbstractFactory.getOMFactory();
+        OMElement axisOperationElement =
+                omFactory.createOMElement(WSDL2Constants.OPERATION_LOCAL_NAME, wsdl);
+        WSDLSerializationUtil.addWSDLDocumentationElement(axisOperation, axisOperationElement,
omFactory, wsdl);
+        axisOperationElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME,
+                                                                      null,
+                                                                      axisOperation.getName().getLocalPart()));
+        URI[] opStyle = (URI[]) axisOperation.getParameterValue(WSDL2Constants.OPERATION_STYLE);
+        if (opStyle != null && opStyle.length > 0) {
+            String style = opStyle[0].toString();
+            for (int i = 1; i < opStyle.length; i++) {
+                URI uri = opStyle[i];
+                style = style + " " + uri;
+            }
+            axisOperationElement.addAttribute(
+                    omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_STYLE, null, style));
+        }
+        axisOperationElement.addAttribute(omFactory.createOMAttribute(
+                WSDL2Constants.ATTRIBUTE_NAME_PATTERN, null, axisOperation.getMessageExchangePattern()));
+        Parameter param = axisOperation.getParameter(WSDL2Constants.ATTR_WSDLX_SAFE);
+        if (param != null) {
+            axisOperationElement.addAttribute(omFactory.createOMAttribute(
+                    WSDL2Constants.ATTRIBUTE_SAFE, wsdlx, (param.getValue()).toString()));
+        }
+        AxisService axisService = (AxisService) axisOperation.getParent();
+        Map nameSpaceMap = axisService.getNameSpacesMap();
+
+        // Add the input element
+        AxisMessage inMessage = (AxisMessage) axisOperation.getChild(WSDLConstants.WSDL_MESSAGE_IN_MESSAGE);
+        if (inMessage != null) {
+            OMElement inMessageElement = omFactory.createOMElement(WSDL2Constants.IN_PUT_LOCAL_NAME,
wsdl);
+            inMessageElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ELEMENT,
null, WSDLSerializationUtil.getElementName(inMessage, nameSpaceMap)));
+            WSDLSerializationUtil.addWSAWActionAttribute(inMessageElement, axisOperation.getInputAction());
+            WSDLSerializationUtil.addWSDLDocumentationElement(inMessage, inMessageElement,
omFactory, wsdl);
+            axisOperationElement.addChild(inMessageElement);
+        }
+
+        // Add the output element
+        AxisMessage outMessage = (AxisMessage) axisOperation.getChild(WSDLConstants.WSDL_MESSAGE_OUT_MESSAGE);
+        if (outMessage != null) {
+            OMElement outMessageElement = omFactory.createOMElement(WSDL2Constants.OUT_PUT_LOCAL_NAME,
wsdl);
+            outMessageElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ELEMENT,
null, WSDLSerializationUtil.getElementName(outMessage, nameSpaceMap)));
+            WSDLSerializationUtil.addWSAWActionAttribute(outMessageElement, axisOperation.getOutputAction());
+            WSDLSerializationUtil.addWSDLDocumentationElement(outMessage, outMessageElement,
omFactory, wsdl);
+            axisOperationElement.addChild(outMessageElement);
+        }
+
+        // Add the fault element
+        ArrayList faults = axisOperation.getFaultMessages();
+        if (faults != null) {
+            Iterator iterator = faults.iterator();
+            while (iterator.hasNext()) {
+                AxisMessage faultMessage = (AxisMessage) iterator.next();
+                OMElement faultElement;
+                if (WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.equals(faultMessage.getDirection()))
{
+                    faultElement = omFactory.createOMElement(WSDL2Constants.IN_FAULT_LOCAL_NAME,
wsdl);
+                } else {
+                    faultElement = omFactory.createOMElement(WSDL2Constants.OUT_FAULT_LOCAL_NAME,
wsdl);
+                }
+                faultElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_REF,
null, tns.getPrefix() + ":" + faultMessage.getName()));
+                WSDLSerializationUtil.addWSAWActionAttribute(faultElement, axisOperation.getFaultAction(faultMessage.getName()));
+                WSDLSerializationUtil.addWSDLDocumentationElement(faultMessage, faultElement,
omFactory, wsdl);
+                axisOperationElement.addChild(faultElement);
+            }
+        }
+        return axisOperationElement;
     }
 }



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


Mime
View raw message