Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Subject : MessageElement#addChildElement(String) should not inherits namespaceURI.
MessageElement#addChildElement(String) inherits namespaceURI of the element to the added child.
For example,
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();
SOAPBody sb = msg.getSOAPBody();
SOAPElement se1 = sb.addChildElement("echoString", "ns1", "http://tempuri.org");
SOAPElement se2 = se1.addChildElement("value");
se2.addTextNode("Hello");
The expected output will be: (namespace decl is omitted for brevity)
<ns1:echoString><value>Hello</value></ns1:echoString>
But AXis's output is :
<ns1:echoString><ns1:value>Hello</value></ns1:echoString>
Thought the SAAJ spec is not clear about this, the SUN RI does not inherit namespaceURI. I think SUN RI's behavior is right.
The patch is simple and below.
Index: java/src/org/apache/axis/message/MessageElement.java
===================================================================
RCS file: /home/cvspublic/ws-axis/java/src/org/apache/axis/message/MessageElement.java,v
retrieving revision 1.194
diff -u -r1.194 MessageElement.java
— java/src/org/apache/axis/message/MessageElement.java 8 Feb 2005 18:44:36 -0000 1.194
+++ java/src/org/apache/axis/message/MessageElement.java 15 Feb 2005 10:00:45 -0000
@@ -1317,8 +1317,8 @@
- @see javax.xml.soap.SOAPElement#addChildElement(String)
*/
public SOAPElement addChildElement(String localName) throws SOAPException {
- // Inherit parent's namespace
- MessageElement child = new MessageElement(getNamespaceURI(),
+ // DO NOT Inherit parent's namespace.
+ MessageElement child = new MessageElement("",
localName);
addChild(child);
return child;