StreamingOMSerializer is invoking the XMLStreamWriter with a wrong sequence of
writes.
--------------------------------------------------------------------------------------
Key: WSCOMMONS-64
URL: http://issues.apache.org/jira/browse/WSCOMMONS-64
Project: WS-Commons
Issue Type: Bug
Reporter: Rich Scheuerle
Assigned To: Rich Scheuerle
I found this problem while debugging AXIS2-913. I attempted to write an Axiom
testcase, but could not reproduce the problem with just Axiom code.
Here is the stack dump from AXIS2-913:
<error message="Unbound namespace URI 'http://test'"
type="javax.xml.stream.XMLStreamException">javax.xml.stream.XMLStreamException:
Unbound namespace URI 'http://test'
at
com.ctc.wstx.sw.SimpleNsStreamWriter.writeStartOrEmpty(SimpleNsStreamWriter.java:240)
at
com.ctc.wstx.sw.BaseNsStreamWriter.writeStartElement(BaseNsStreamWriter.java:273)
at
org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartElement(MTOMXMLStreamWriter.java:87)
at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeElement(StreamingOMSerializer.java:123)
at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(StreamingOMSerializer.java:73)
at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:56)
at
org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:325)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:792)
at
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:177)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:811)
at
org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:378)
at
org.apache.axis2.jaxws.message.MessageTests.testJAXBOutflow(MessageTests.java:304)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
The root of the problem is that StreamingOMSerializer is invoking the writer
using an incorrect StAX sequence.
This results in the writer reporting an unbound namespace.
Similar (or the same problem) has been report in WSCOMMONS-33 and WSCOMMONS-62
I have a fix for the problem. I will be posting a patch in a few minutes.
Here is the "new" algorithm that I have added to the
StreamingOMSerializer.serializeElement:
// The algorithm is:
// ... generate setPrefix/setDefaultNamespace for each namespace
declaration if the prefix is unassociated.
// ... generate setPrefix/setDefaultNamespace if the prefix of the
element is unassociated
// ... generate setPrefix/setDefaultNamespace for each unassociated
prefix of the attributes.
//
// ... generate writeStartElement
//
// ... generate writeNamespace/writerDefaultNamespace for each
namespace declaration on the element
// ... generate writeNamespace/writeDefaultNamespace for any new
"autogen" namespace/prefixes
// ... generate writeAttribute for each attribute
I have peer reviewed the code with a member of IBM's parser team (Perter
McCracken) and several of the IBM JAX-WS contributors.
I would like a peer review from the Axiom community.
This issue is holding up some critical development in the JAXWS code. So I
will be committing the fix later today, unless I get some negative feedback.
Thanks,
scheu
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]