[ http://issues.apache.org/jira/browse/AXIS-2029?page=comments#action_66839 ] Venkat Reddy commented on AXIS-2029: ------------------------------------
I think we should accept TextNode also as child for SOAPHeader block. Does anyone know why the NodeImpl.appendChild has been overridden? SOAP 1.2 spec: "Each SOAP header block element information item MAY have any number of character information item children. Child character information items whose character code is amongst the white space characters as defined by XML 1.0 are considered significant". Seems it also applies for SOAPBody ! - venkat > SOAPHeader.appendChild() throws unexpected ClassCastException > ------------------------------------------------------------- > > Key: AXIS-2029 > URL: http://issues.apache.org/jira/browse/AXIS-2029 > Project: Axis > Type: Bug > Components: Basic Architecture, SAAJ > Versions: 1.2 > Environment: Windows XP Pro/WebSphere 4.0 > Reporter: Mark Tye > Attachments: 2029.diff > > The class org.apache.axis.message.SOAPHeader overrides the > appendChild(org.w3c.dom.Node) method of org.apache.axis.message.NodeImpl in > such a way that it breaks the contract of the > org.3c.dom.Node.appendChild(org.w3c.dom.Node) interface. > Here's the implementation of appendChild(Node) in SOAPHeader: > 390 public Node appendChild(Node newChild) throws DOMException { > 391 SOAPHeaderElement headerElement = null; > 392 if(newChild instanceof SOAPHeaderElement) > 393 headerElement = (SOAPHeaderElement)newChild; > 394 else > 395 headerElement = new SOAPHeaderElement((Element)newChild); > 396 try { > 397 addChildElement(headerElement); > 398 } catch (SOAPException e) { > 399 throw new > DOMException(DOMException.INVALID_STATE_ERR,e.toString()); > 400 } > 401 return headerElement; > 402 } > This works fine if the newChild Node parameter is an instance of > SOAPHeaderElement or org.w3c.dom.Element, but any other subclass of Node will > cause a ClassCastException to be thrown at line 395. > It's reasonable to expect that in most cases, the Node being appended to a > SOAP Header will be DOM Element representing a header entry. However, there > is no prohibition in the SOAP 1.1 Note or the SOAP 1.2 Recommendation against > whitespace before, after, or in between the header entries of a SOAP Header. > Some parsers will render such whitespace as Text nodes, which will cause a > ClassCastException in the appendChild() method. > Even if a deliberate design decision has been made not to support whitespace > in the SOAPHeader class, the appendChild(Node) method should probably do > something more elegant than throw a ClassCastException if the Node parameter > is a Text node containing whitespace. -- 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
