[ 
https://issues.apache.org/jira/browse/AXIOM-439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461385#comment-13461385
 ] 

Brian Reinhold commented on AXIOM-439:
--------------------------------------

I have more information on this bug after getting source for rampart, axiom, 
and wss4j and running the application using the projects instead of the jars. 
The problem occurs when Rampart attempts to add the SAML token acquired by its 
own STS service to the security header of the next outgoing SOAP message to the 
service requiring the security token. The stack trace looks as follows:
End of the document reachedjava.util.NoSuchElementException: End of the 
document reached
        at 
org.apache.axiom.om.impl.common.SwitchingWrapper.next(SwitchingWrapper.java:931)
        at javax.xml.stream.util.StreamReaderDelegate.next(Unknown Source)
        at 
org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
        at 
org.apache.axiom.util.stax.debug.XMLStreamReaderValidator.next(XMLStreamReaderValidator.java:69)
        at 
org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:646)
        at 
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:189)
        at 
org.apache.axiom.om.impl.common.OMContainerHelper.buildNext(OMContainerHelper.java:162)
        at 
org.apache.axiom.om.impl.common.OMContainerHelper.getFirstOMChild(OMContainerHelper.java:174)
        at 
org.apache.axiom.om.impl.dom.ParentNode.getFirstOMChild(ParentNode.java:126)
        at 
org.apache.axiom.om.impl.dom.ParentNode.getFirstChild(ParentNode.java:185)
        at 
org.apache.axiom.om.impl.dom.DocumentImpl.importNode(DocumentImpl.java:352)
        at 
org.apache.axiom.om.impl.dom.DocumentImpl.importNode(DocumentImpl.java:354)
        at 
org.apache.rampart.util.RampartUtil.appendChildToSecHeader(RampartUtil.java:826)
        at 
org.apache.rampart.util.RampartUtil.insertSiblingAfter(RampartUtil.java:834)
        at 
org.apache.rampart.builder.BindingBuilder.handleSupportingTokens(BindingBuilder.java:381)
        at 
org.apache.rampart.builder.TransportBindingBuilder.build(TransportBindingBuilder.java:148)

I do not understand how all these xml engines work in order to make much sense 
of the debug output. I do see that the 'elementLevel' is non-zero while the 
'event' is set to end of document, and the 'unknown source' is scary.

I tried to simulate this in an application that skipped the STS transaction by 
saving the token to a file. However, that did not work. In that case when 
reading back the token and using 'OMElement payload = 
AXIOMUtil.stringToOM(str);' the loading process encountered a different 
exception where the OMElement could not be cast to an Element in an ugly stack 
trace that looks as follows:

java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl 
cannot be cast to org.w3c.dom.Element
        at 
org.apache.rampart.builder.BindingBuilder.handleSupportingTokens(BindingBuilder.java:382)
        at 
org.apache.rampart.builder.TransportBindingBuilder.build(TransportBindingBuilder.java:148)
        at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:140)
        at 
org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
        at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
        at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
        at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
        at 
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)

At this point I do not know if it is a Rampart bug (not using Axiom correctly) 
or an Axiom bug (an inconsistency in the 'state', 'elementLevel', and 'event' 
values.

I have attached the above project as a zip file. It does not need any services 
to run. If one can get by the cast bug then maybe the other bug will be 
revealed.
                
> Reporting unexpected END OF DOCUMENT
> ------------------------------------
>
>                 Key: AXIOM-439
>                 URL: https://issues.apache.org/jira/browse/AXIOM-439
>             Project: Axiom
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.2.13, 1.2.14
>         Environment: Axis2 Rampart running in Tomcat
>            Reporter: Brian Reinhold
>              Labels: patch
>             Fix For: 1.2.9
>
>         Attachments: BaseManagerWan_SecureAxis2SendTest.zip, sendToWan.xml
>
>
> Handling an XML SOAP document on the client that worked with Axis2 version 
> 1.5.2, Axiom 1.2.9, Rampart 1.5.1 now throws an OMException "Unexpected 
> END_DOCUMENT event" when Axis2 and Rampart is updated to 1.6.2 and Axiom is 
> updated to all of the versions above. The 1.2.14 version is especially 
> important due to a fix for Rampart on the server side.
> The stack trace is as follows. Attached is the SOAP document as picked up on 
> the wire using Wireshark when using the working versions of the above 
> libraries. The source code is otherwise unchanged between the the usages of 
> the various libraries. I have replaced the SOAP body with the simple text 
> string "Hi" to make sure it was not something ugly in the PCD-01 body and the 
> error still occurs. The SAML token is generated by the Rampart STS service 
> and is generated identically in both the 1.6.2 and 1.5.1 versions.
> org.apache.axiom.om.OMException: Unexpected END_DOCUMENT event
>       at 
> org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:660)
>       at 
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:189)
>       at 
> org.apache.axiom.om.impl.dom.OMContainerHelper.buildNext(OMContainerHelper.java:162)
>       at 
> org.apache.axiom.om.impl.dom.OMContainerHelper.getFirstOMChild(OMContainerHelper.java:174)
>       at 
> org.apache.axiom.om.impl.dom.ParentNode.getFirstOMChild(ParentNode.java:126)
>       at 
> org.apache.axiom.om.impl.dom.ParentNode.getFirstChild(ParentNode.java:185)
>       at 
> org.apache.axiom.om.impl.dom.DocumentImpl.importNode(DocumentImpl.java:352)
>       at 
> org.apache.axiom.om.impl.dom.DocumentImpl.importNode(DocumentImpl.java:354)
>       at 
> org.apache.rampart.util.RampartUtil.appendChildToSecHeader(RampartUtil.java:826)
>       at 
> org.apache.rampart.util.RampartUtil.insertSiblingAfter(RampartUtil.java:834)
>       at 
> org.apache.rampart.builder.BindingBuilder.handleSupportingTokens(BindingBuilder.java:380)
>       at 
> org.apache.rampart.builder.TransportBindingBuilder.build(TransportBindingBuilder.java:148)
>       at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:140)
>       at 
> org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
>       at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
>       at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
>       at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
>       at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
>       at 
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
>       at 
> com.lampreynetworks.ahd.wan.sender.axis2.SecureAxis2WanSender.sendDocument(SecureAxis2WanSender.java:113)
>       at 
> BaseManagerWan_SecureAxis2Send$3.documentClosed(BaseManagerWan_SecureAxis2Send.java:142)
>       at 
> com.lampreynetworks.ahd.pcd.document.PanToPcdTranslator.documentFinished(PanToPcdTranslator.java:223)
>       at 
> com.lampreynetworks.ahd.pcd.document.PanToPcdTranslator.notifyStateChange(PanToPcdTranslator.java:208)
>       at 
> com.lampreynetworks.ahd.oxp.manager.FiniteStateMachine.setState(FiniteStateMachine.java:415)
>       at 
> com.lampreynetworks.ahd.oxp.manager.FiniteStateMachine.access$4(FiniteStateMachine.java:373)
>       at 
> com.lampreynetworks.ahd.oxp.manager.FiniteStateMachine$ApduFilter.receive(FiniteStateMachine.java:811)
>       at 
> com.lampreynetworks.ahd.oxp.manager.FiniteStateMachine$ApduFilter.receive(FiniteStateMachine.java:1)
>       at com.lampreynetworks.ahd.oxp.Asn$RlrqApdu.dispatch(Asn.java:7092)
>       at 
> com.lampreynetworks.ahd.oxp.manager.FiniteStateMachine.filterApdu(FiniteStateMachine.java:316)
>       at 
> com.lampreynetworks.ahd.oxp.manager.FiniteStateMachine.receiveApdu(FiniteStateMachine.java:186)
>       at sockettcp.SocketTcpNexus$1.run(SocketTcpNexus.java:104)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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]

Reply via email to