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 "Jongjin Choi (JIRA)" <ax...@ws.apache.org> on 2005/02/15 11:52:51 UTC

[jira] Created: (AXIS-1819) addChildElement(String) should not namespaceURI

addChildElement(String) should not namespaceURI 
------------------------------------------------

         Key: AXIS-1819
         URL: http://issues.apache.org/jira/browse/AXIS-1819
     Project: Axis
        Type: Bug
  Components: SAAJ  
    Versions: current (nightly)    
    Reporter: Jongjin Choi


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;



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-1819) addChildElement(String) should not namespaceURI

Posted by "Changshin Lee (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-1819?page=comments#action_12362515 ] 

Changshin Lee commented on AXIS-1819:
-------------------------------------

According to SAAJ 1.3 at http://www.jcp.org/aboutJava/communityprocess/maintenance/jsr067/SAAJ1_3ChangeLog_4.html

addChildElement

SOAPElement addChildElement(java.lang.String localName)
                            throws SOAPException
Creates a new SOAPElement object initialized with the specified local name and adds the new element to this SOAPElement object.  The new  SOAPElement  inherits any in-scope default namespace.

Therefore,

MessageElement child = new MessageElement(getNamespaceURI(""), localName);

makes the method work as the spec clarifies.


> addChildElement(String) should not namespaceURI
> -----------------------------------------------
>
>          Key: AXIS-1819
>          URL: http://issues.apache.org/jira/browse/AXIS-1819
>      Project: Apache Axis
>         Type: Bug
>   Components: SAAJ
>     Versions: current (nightly)
>     Reporter: Jongjin Choi

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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-1819) addChildElement(String) should not namespaceURI

Posted by "Changshin Lee (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-1819?page=comments#action_12362518 ] 

Changshin Lee commented on AXIS-1819:
-------------------------------------

The change proposed above affects programs which rely on the current mechanism. I'd like to hear your opinions on that.

> addChildElement(String) should not namespaceURI
> -----------------------------------------------
>
>          Key: AXIS-1819
>          URL: http://issues.apache.org/jira/browse/AXIS-1819
>      Project: Apache Axis
>         Type: Bug
>   Components: SAAJ
>     Versions: current (nightly)
>     Reporter: Jongjin Choi

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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira