axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kei...@apache.org
Subject svn commit: r540059 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: description/ util/
Date Mon, 21 May 2007 08:33:01 GMT
Author: keithc
Date: Mon May 21 01:33:00 2007
New Revision: 540059

URL: http://svn.apache.org/viewvc?view=rev&rev=540059
Log:
Adding documentation property to axisDescription in order to capture documentation stated
in the wsdl.
Populating AxisService with documentation captured from the wsdl
Serializing all documentation details in ?wsdl2
Got to set it up in ?wsdl


Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java?view=diff&rev=540059&r1=540058&r2=540059
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
Mon May 21 01:33:00 2007
@@ -198,6 +198,7 @@
             AxisBindingOperation axisBindingOperation = (AxisBindingOperation) iterator.next();
             bindingElement.addChild(axisBindingOperation.toWSDL20(wsdl, tns, wsoap, whttp,
type, nameSpaceMap));
         }
+        WSDLSerializationUtil.addWSDL2DocumentationElement(this, bindingElement, omFactory,
wsdl);
         return bindingElement;
     }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java?view=diff&rev=540059&r1=540058&r2=540059
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
Mon May 21 01:33:00 2007
@@ -196,6 +196,7 @@
         if (list != null && list.size() > 0) {
             WSDLSerializationUtil.addSOAPModuleElements(omFactory, list, wsoap, bindingMessageElement);
         }
+        WSDLSerializationUtil.addWSDL2DocumentationElement(this, bindingMessageElement, omFactory,
wsdl);
         return bindingMessageElement;
     }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java?view=diff&rev=540059&r1=540058&r2=540059
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
Mon May 21 01:33:00 2007
@@ -211,7 +211,7 @@
                 bindingOpElement.addChild(faultMessage.toWSDL20(wsdl, tns, wsoap, whttp,
nameSpaceMap));
             }
         }
-
+        WSDLSerializationUtil.addWSDL2DocumentationElement(this, bindingOpElement, omFactory,
wsdl);
         return bindingOpElement;
     }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java?view=diff&rev=540059&r1=540058&r2=540059
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
Mon May 21 01:33:00 2007
@@ -42,6 +42,9 @@
 
     private HashMap children;
 
+    // Holds the documentation details for each element
+    private String documentation;
+
     // creating a logger instance
     private Log log = LogFactory.getLog(this.getClass());
 
@@ -109,6 +112,14 @@
 
         Parameter parameter = getParameter(parameterName);
         return parameter != null && parameter.isLocked();
+    }
+
+    public String getDocumentation() {
+        return documentation;
+    }
+
+    public void setDocumentation(String documentation) {
+        this.documentation = documentation;
     }
 
     public void setParent(AxisDescription parent) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java?view=diff&rev=540059&r1=540058&r2=540059
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
Mon May 21 01:33:00 2007
@@ -19,6 +19,7 @@
 package org.apache.axis2.description;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.util.WSDLSerializationUtil;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMFactory;
@@ -127,6 +128,7 @@
         if (property != null) {
            endpointElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_AUTHENTICATION_REALM,
whttp, property));
         }
+        WSDLSerializationUtil.addWSDL2DocumentationElement(this, endpointElement, omFactory,
wsdl);
         return endpointElement;
     }
 }

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=540059&r1=540058&r2=540059
==============================================================================
--- 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
Mon May 21 01:33:00 2007
@@ -646,6 +646,7 @@
         OMFactory omFactory = OMAbstractFactory.getOMFactory();
         OMElement axisOperationElement =
                 omFactory.createOMElement(WSDL2Constants.OPERATION_LOCAL_NAME, wsdl);
+        WSDLSerializationUtil.addWSDL2DocumentationElement(this, axisOperationElement, omFactory,
wsdl);
         axisOperationElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME,
                                                                       null,
                                                                       this.getName().getLocalPart()));
@@ -665,6 +666,7 @@
             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.addWSDL2DocumentationElement(inMessage, inMessageElement,
omFactory, wsdl);
             axisOperationElement.addChild(inMessageElement);
         }
 
@@ -674,6 +676,7 @@
             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.addWSDL2DocumentationElement(outMessage, outMessageElement,
omFactory, wsdl);
             axisOperationElement.addChild(outMessageElement);
         }
 
@@ -691,6 +694,7 @@
                 }
                 faultElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_REF,
null, tns.getPrefix() + ":" + faultMessage.getName()));
                 WSDLSerializationUtil.addWSAWActionAttribute(faultElement, getFaultAction(faultMessage.getName()));
+                WSDLSerializationUtil.addWSDL2DocumentationElement(faultMessage, faultElement,
omFactory, wsdl);
                 axisOperationElement.addChild(faultElement);
             }
         }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=540059&r1=540058&r2=540059
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
Mon May 21 01:33:00 2007
@@ -124,7 +124,6 @@
 
     // to store engaged modules
     private ArrayList engagedModules = null;
-    private String serviceDescription;
 
     // to store the wsdl definition , which is build at the deployment time
     // to keep the time that last update time of the service
@@ -1051,11 +1050,11 @@
 
     /**
      * Gets the description about the service which is specified in services.xml.
-     *
+     * @deprecated Use getDocumentation() instead
      * @return Returns String.
      */
     public String getServiceDescription() {
-        return serviceDescription;
+        return getDocumentation();
     }
 
     /*
@@ -1213,11 +1212,11 @@
 
     /**
      * Sets the description about the service which is specified in services.xml
-     *
-     * @param serviceDescription
+     * @deprecated Use setDocumentation() instead
+     * @param documentation
      */
-    public void setServiceDescription(String serviceDescription) {
-        this.serviceDescription = serviceDescription;
+    public void setServiceDescription(String documentation) {
+        setDocumentation(documentation);
     }
 
     /*

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java?view=diff&rev=540059&r1=540058&r2=540059
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
Mon May 21 01:33:00 2007
@@ -6,12 +6,14 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMText;
 import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.util.WSDLSerializationUtil;
 import org.apache.axis2.AxisFault;
 import org.apache.ws.commons.schema.XmlSchema;
 
 import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamConstants;
 import java.io.ByteArrayInputStream;
 import java.io.StringWriter;
 import java.io.OutputStream;
@@ -110,10 +112,18 @@
         String description;
         OMElement documentationElement =
                 omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
-        if ((description = axisService.getServiceDescription()) != null) {
-            documentationElement.setText(description);
+        if ((description = axisService.getDocumentation()) != null) {
+            OMText omText;
+            if (description.indexOf(WSDLSerializationUtil.CDATA_START) > -1) {
+                description = description.replaceFirst(WSDLSerializationUtil.CDATA_START_REGEX,
"");
+                description = description.replaceFirst(WSDLSerializationUtil.CDATA_END_REGEX,
"");
+                omText = omFactory.createOMText(description, XMLStreamConstants.CDATA);
+            } else {
+            omText =  omFactory.createOMText(description);
+            }
+            documentationElement.addChild(omText);
+            descriptionElement.addChild(documentationElement);
         }
-        descriptionElement.addChild(documentationElement);
 
         // Add types element
         OMElement typesElement = omFactory.createOMElement(WSDL2Constants.TYPES_LOCAL_NALE,
wsdl);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?view=diff&rev=540059&r1=540058&r2=540059
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Mon May 21 01:33:00 2007
@@ -273,16 +273,7 @@
             // copy the documentation element content to the description
             Element documentationElement = wsdl4jDefinition
                     .getDocumentationElement();
-            if ((documentationElement != null) && (documentationElement.getFirstChild()
!= null)) {
-                Node firstChild = documentationElement.getFirstChild();
-                String serviceDes;
-                if (firstChild.getNodeType() == Node.TEXT_NODE) {
-                    serviceDes = firstChild.getNodeValue();
-                } else {
-                    serviceDes = DOM2Writer.nodeToString(firstChild);
-                }
-                axisService.setServiceDescription(serviceDes);
-            }
+            addDocumentation(axisService, documentationElement);
 
             axisService.setName(wsdl4jService.getQName().getLocalPart());
             populateEndpoints(binding, wsdl4jService);
@@ -297,6 +288,16 @@
         }
     }
 
+    private void addDocumentation(AxisDescription axisDescription, Element documentationElement)
{
+        if ((documentationElement != null) && (documentationElement.getFirstChild()
!= null)) {
+            Node firstChild = documentationElement.getFirstChild();
+            String documentation = DOM2Writer.nodeToString(firstChild);
+            if (!"".equals(documentation)) {
+                axisDescription.setDocumentation(documentation);
+            }
+        }
+    }
+
     /**
      * @param binding
      * @param wsdl4jService must have atlease one port
@@ -364,7 +365,7 @@
 
         axisBinding.setName(wsdl4jBinding.getQName());
         axisEndpoint.setBinding(axisBinding);
-
+        addDocumentation(axisEndpoint, wsdl4jPort.getDocumentationElement());
         populateBinding(axisBinding, wsdl4jBinding, isSetMessageQNames);
 
 
@@ -373,7 +374,6 @@
     private void populatePortType(PortType wsdl4jPortType) throws AxisFault {
         List wsdl4jOperations = wsdl4jPortType.getOperations();
 
-
         // Added to use in ?wsdl2 as the interface name
         axisService.addParameter(new Parameter(WSDL2Constants.INTERFACE_LOCAL_NAME,
                                                wsdl4jPortType.getQName().getLocalPart()));
@@ -391,6 +391,7 @@
             wsdl4jOperation = (Operation) iterator.next();
 
             axisOperation = populateOperations(wsdl4jOperation, wsdl4jPortType, wsdl4jDefinition);
+            addDocumentation(axisOperation, wsdl4jOperation.getDocumentationElement());
             axisOperation.setParent(axisService);
             axisService.addChild(axisOperation);
             operationNames.add(axisOperation.getName());
@@ -416,6 +417,8 @@
             throw new AxisFault("No operation found for the binding");
         }
 
+        addDocumentation(axisBinding, wsdl4jBinding.getDocumentationElement());
+
         AxisOperation axisOperation;
         Operation wsdl4jOperation;
 
@@ -436,6 +439,7 @@
             wsdl4jOperation = findOperation(portType, wsdl4jBindingOperation);
 
             axisBindingOperation.setName(new QName("", wsdl4jBindingOperation.getName()));
+            addDocumentation(axisBindingOperation, wsdl4jBindingOperation.getDocumentationElement());
 
             axisOperation = axisService.getOperation(new QName("", wsdl4jOperation.getName()));
             axisBindingOperation.setAxisOperation(axisOperation);
@@ -457,6 +461,7 @@
                     WSDLUtil.isInputPresentForMEP(axisOperation.getMessageExchangePattern()))
{
 
                 AxisBindingMessage axisBindingInMessage = new AxisBindingMessage();
+                addDocumentation(axisBindingInMessage, wsdl4jBindingInput.getDocumentationElement());
                 copyExtensibleElements(wsdl4jBindingInput.getExtensibilityElements(),
                                        wsdl4jDefinition,
                                        axisBindingInMessage, BINDING_OPERATION_INPUT);
@@ -482,6 +487,7 @@
             if (wsdl4jBindingOutput != null &&
                     WSDLUtil.isOutputPresentForMEP(axisOperation.getMessageExchangePattern()))
{
                 AxisBindingMessage axisBindingOutMessage = new AxisBindingMessage();
+                addDocumentation(axisBindingOutMessage, wsdl4jBindingOutput.getDocumentationElement());
                 AxisMessage axisOutMessage =
                         axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
 
@@ -518,6 +524,7 @@
                         axisOperation.getFaultMessages());
 
                 AxisBindingMessage axisBindingFaultMessage = new AxisBindingMessage();
+                addDocumentation(axisBindingFaultMessage, wsdl4jFaultMessge.getDocumentationElement());
                 axisBindingFaultMessage.setFault(true);
                 axisBindingFaultMessage.setAxisMessage(faultMessage);
                 axisBindingFaultMessage.setParent(axisBindingOperation);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?view=diff&rev=540059&r1=540058&r2=540059
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
Mon May 21 01:33:00 2007
@@ -36,6 +36,7 @@
 import org.apache.woden.wsdl20.InterfaceMessageReference;
 import org.apache.woden.wsdl20.InterfaceOperation;
 import org.apache.woden.wsdl20.Service;
+import org.apache.woden.wsdl20.WSDLComponent;
 import org.apache.woden.wsdl20.enumeration.MessageLabel;
 import org.apache.woden.wsdl20.extensions.http.HTTPBindingFaultExtensions;
 import org.apache.woden.wsdl20.extensions.http.HTTPBindingMessageReferenceExtensions;
@@ -52,9 +53,11 @@
 import org.apache.woden.wsdl20.xml.DescriptionElement;
 import org.apache.woden.wsdl20.xml.TypesElement;
 import org.apache.woden.wsdl20.xml.DocumentationElement;
+import org.apache.woden.wsdl20.xml.DocumentableElement;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
@@ -71,6 +74,8 @@
 import java.util.TreeMap;
 import java.util.Comparator;
 
+import com.ibm.wsdl.util.xml.DOM2Writer;
+
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -177,10 +182,11 @@
 
             // if there are documentation elements in the root. Lets add them as the wsdlService
description
             // but since there can be multiple documentation elements, lets only add the
first one
-            DocumentationElement[] documentationElements = description.toElement().getDocumentationElements();
-            if (documentationElements != null && documentationElements.length >
0) {
-                axisService.setServiceDescription(documentationElements[0].getContent().toString());
-            }
+            addDocumentation(axisService, description.toElement());
+//            DocumentationElement[] documentationElements = description.toElement().getDocumentationElements();
+//            if (documentationElements != null && documentationElements.length >
0) {
+//                axisService.setServiceDescription(documentationElements[0].getContent().toString());
+//            }
 
             // adding ns in the original WSDL
             // processPoliciesInDefintion(wsdl4jDefinition); TODO : Defering policy handling
for now - Chinthaka
@@ -329,6 +335,7 @@
                                      soapEndpointExtensions.getHttpAuthenticationRealm());
 
         }
+        addDocumentation(axisEndpoint, endpoint.toElement());
         return axisEndpoint;
 
     }
@@ -413,6 +420,7 @@
         // We should process the interface based on the service not on a binding
 
         processedBindings.put(binding.getName(), axisBinding);
+        addDocumentation(axisBinding, binding.toElement());
         return axisBinding;
     }
 
@@ -480,6 +488,7 @@
             axisBindingFault.setName(interfaceFault.getName().getLocalPart());
             axisBindingFault.setParent(axisBinding);
 
+            addDocumentation(axisBindingFault, interfaceFault.toElement());
             SOAPBindingFaultExtensions soapBindingFaultExtensions = null;
 
             try {
@@ -522,7 +531,7 @@
             axisBindingOperation.setAxisOperation(axisOperation);
             axisBindingOperation.setParent(axisBinding);
             axisBindingOperation.setName(axisOperation.getName());
-
+            addDocumentation(axisBindingOperation, bindingOperation.toElement());
             SOAPBindingOperationExtensions soapBindingOperationExtensions = null;
             try {
                 soapBindingOperationExtensions = ((SOAPBindingOperationExtensions)
@@ -572,7 +581,7 @@
 
                 AxisBindingMessage axisBindingMessage = new AxisBindingMessage();
                 axisBindingMessage.setParent(axisBindingOperation);
-
+                addDocumentation(axisBindingMessage, bindingMessageReference.toElement());
                 AxisMessage axisMessage = axisOperation.getMessage(bindingMessageReference
                         .getInterfaceMessageReference().getMessageLabel().toString());
 
@@ -613,6 +622,7 @@
                 BindingFaultReference bindingFaultReference = bindingFaultReferences[j];
 
                 AxisBindingMessage axisBindingMessageFault = new AxisBindingMessage();
+                addDocumentation(axisBindingMessageFault, bindingFaultReference.toElement());
                 axisBindingMessageFault.setParent(axisBindingOperation);
                 axisBindingMessageFault.setFault(true);
                 axisBindingMessageFault.setName(bindingFaultReference.getInterfaceFaultReference()
@@ -681,6 +691,7 @@
             axisBindingFault.setName(interfaceFault.getName().getLocalPart());
             axisBindingFault.setParent(axisBinding);
 
+            addDocumentation(axisBindingFault, interfaceFault.toElement());
             HTTPBindingFaultExtensions httpBindingFaultExtensions = null;
 
             try {
@@ -716,6 +727,7 @@
             axisBindingOperation.setParent(axisBinding);
             axisBindingOperation.setName(axisOperation.getName());
 
+            addDocumentation(axisBindingOperation, bindingOperation.toElement());
             HTTPBindingOperationExtensions httpBindingOperationExtensions = null;
             try {
                 httpBindingOperationExtensions = ((HTTPBindingOperationExtensions)
@@ -773,7 +785,7 @@
                 axisBindingMessage.setName(axisMessage.getName());
                 axisBindingMessage.setDirection(axisMessage.getDirection());
 
-
+                addDocumentation(axisBindingMessage, bindingMessageReference.toElement());
                 HTTPBindingMessageReferenceExtensions httpBindingMessageReferenceExtensions
= null;
                 try {
                     httpBindingMessageReferenceExtensions =
@@ -804,6 +816,7 @@
                         .getInterfaceFault().getName().getLocalPart());
                 axisBindingMessageFault.setParent(axisBindingOperation);
                 axisBindingOperation.addFault(axisBindingMessageFault);
+                addDocumentation(axisBindingMessageFault, bindingFaultReference.toElement());
 
             }
 
@@ -853,6 +866,8 @@
 
         }
 
+        addDocumentation(axisOperation, operation.toElement());
+
         // assuming the style of the operations of WSDL 2.0 is always document, for the time
being :)
         // The following can be used to capture the wsdlx:safe attribute
 
@@ -1035,4 +1050,26 @@
         }
         return httpHeaderMessages;
     }
-}
+
+    /**
+     * Adds documentation details to a given AxisDescription.
+     * The documentation details is extracted from the WSDL element given.
+     * @param axisDescription - The documentation will be added to this
+     * @param element - The element that the documentation is extracted from.
+     */
+    private void addDocumentation(AxisDescription axisDescription, DocumentableElement element)
{
+        DocumentationElement[] documentationElements = element.getDocumentationElements();
+        String documentation = "";
+        StringBuffer x;
+        for (int i = 0; i < documentationElements.length; i++) {
+            DocumentationElement documentationElement = documentationElements[i];
+            Element content = (Element) documentationElement.getContent();
+            if (content != null) {
+                documentation = documentation + DOM2Writer.nodeToString(content.getFirstChild());
+            }
+        }
+        if (!"".equals(documentation)) {
+            axisDescription.setDocumentation(documentation);
+        }
+    }
+}
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java?view=diff&rev=540059&r1=540058&r2=540059
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
Mon May 21 01:33:00 2007
@@ -22,6 +22,7 @@
 import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisDescription;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.wsdl.SOAPHeaderMessage;
 import org.apache.axis2.wsdl.SOAPModuleMessage;
@@ -32,9 +33,11 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMText;
 import org.apache.ws.java2wsdl.Java2WSDLConstants;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
 import java.util.Map;
 import java.util.Iterator;
 import java.util.ArrayList;
@@ -45,6 +48,11 @@
  */
 public class WSDLSerializationUtil {
 
+    public static final String CDATA_START = "<![CDATA[";
+    public static final String CDATA_START_REGEX = "<!\\[CDATA\\[";
+    public static final String CDATA_END = "]]>";
+    public static final String CDATA_END_REGEX = "\\]\\]>";
+
     /**
      * Given a namespace it returns the prefix for that namespace
      * @param namespace - The namespace that the prefix is needed for
@@ -372,6 +380,24 @@
                                 AddressingConstants.USING_ADDRESSING,
                                 "required", "true",
                                 wsawNamespace);
+        }
+    }
+
+    public static void addWSDL2DocumentationElement(AxisDescription axisDescription, OMElement
omElement, OMFactory omFactory, OMNamespace wsdl) {
+        String documentationString = axisDescription.getDocumentation();
+        OMElement documentation = null;
+        if (documentationString != null && !"".equals(documentationString)) {
+            documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
+            OMText omText;
+            if (documentationString.indexOf(CDATA_START) > -1) {
+                documentationString = documentationString.replaceFirst(CDATA_START_REGEX,
"");
+                documentationString = documentationString.replaceFirst(CDATA_END_REGEX, "");
+                omText = omFactory.createOMText(documentationString, XMLStreamConstants.CDATA);
+            } else {
+            omText =  omFactory.createOMText(documentationString);
+            }
+            documentation.addChild(omText);
+            omElement.addChild(documentation);
         }
     }
 }



---------------------------------------------------------------------
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