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:24:00 UTC
svn commit: r597681 - in
/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2:
deployment/ServiceBuilder.java description/AxisDescription.java
util/WSDLSerializationUtil.java
Author: keithc
Date: Fri Nov 23 07:23:59 2007
New Revision: 597681
URL: http://svn.apache.org/viewvc?rev=597681&view=rev
Log:
Fixing Axis2-3181 by adding a method getDocumentationNode to AxisDescription. Now if the WSDL contains documentation as XML it is displayed nicely in the genarated WSDL.
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.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/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=597681&r1=597680&r2=597681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java Fri Nov 23 07:23:59 2007
@@ -130,11 +130,7 @@
if (descriptionElement != null) {
OMElement descriptionValue = descriptionElement.getFirstElement();
if (descriptionValue != null) {
- StringWriter writer = new StringWriter();
- descriptionValue.build();
- descriptionValue.serialize(writer);
- writer.flush();
- service.setDocumentation(writer.toString());
+ service.setDocumentation(descriptionValue);
} else {
service.setDocumentation(descriptionElement.getText());
}
@@ -383,8 +379,6 @@
processDataLocatorConfig(dataLocatorElement, service);
}
- } catch (XMLStreamException e) {
- throw new DeploymentException(e);
} catch (AxisFault axisFault) {
throw new DeploymentException(axisFault);
}
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?rev=597681&r1=597680&r2=597681&view=diff
==============================================================================
--- 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 Fri Nov 23 07:23:59 2007
@@ -16,23 +16,26 @@
package org.apache.axis2.description;
+import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNode;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.util.Utils;
-import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.modules.Module;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Collection;
import java.util.Map;
public abstract class AxisDescription implements ParameterInclude,
@@ -48,8 +51,10 @@
protected Map engagedModules;
+ private OMFactory omFactory = OMAbstractFactory.getOMFactory();
+
// Holds the documentation details for each element
- private String documentation;
+ private OMNode documentation;
// creating a logger instance
private Log log = LogFactory.getLog(this.getClass());
@@ -137,11 +142,22 @@
}
public String getDocumentation() {
+ if (documentation != null) {
+ return documentation.toString();
+ }
+ return null;
+ }
+
+ public OMNode getDocumentationNode() {
return documentation;
}
- public void setDocumentation(String documentation) {
+ public void setDocumentation(OMNode documentation) {
this.documentation = documentation;
+ }
+
+ public void setDocumentation(String documentation) {
+ this.documentation = omFactory.createOMText(documentation);
}
public void setParent(AxisDescription parent) {
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?rev=597681&r1=597680&r2=597681&view=diff
==============================================================================
--- 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 Fri Nov 23 07:23:59 2007
@@ -18,28 +18,27 @@
*/
package org.apache.axis2.util;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.description.AxisDescription;
import org.apache.axis2.description.AxisMessage;
-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.description.WSDL2Constants;
import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.axis2.namespace.Constants;
+import org.apache.axis2.wsdl.HTTPHeaderMessage;
import org.apache.axis2.wsdl.SOAPHeaderMessage;
import org.apache.axis2.wsdl.SOAPModuleMessage;
-import org.apache.axis2.wsdl.HTTPHeaderMessage;
-import org.apache.axis2.namespace.Constants;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-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 javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import java.util.Map;
-import java.util.Iterator;
import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
import java.util.Set;
/**
@@ -468,19 +467,11 @@
}
public static void addWSDLDocumentationElement(AxisDescription axisDescription, OMElement omElement, OMFactory omFactory, OMNamespace wsdl) {
- String documentationString = axisDescription.getDocumentation();
+ OMNode documentationNode = axisDescription.getDocumentationNode();
OMElement documentation;
- if (documentationString != null && !"".equals(documentationString)) {
+ if (documentationNode != null) {
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);
+ documentation.addChild(documentationNode);
omElement.addChild(documentation);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org