Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-464

The use of WS Addressing results in malformed SOAP messages

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.5.5
    • Fix Version/s: 1.5.6
    • Component/s: Core
    • Labels:
      None

      Description

      When WS Addressing is being used the Axiom message factory appears to produce malformed SOAP messages (details to follow)

        Activity

        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        The duplicate namespace declarations are now gone. I've added a 'addNamespaceDeclaration()' method to SoapElement.

        Show
        arjen.poutsma Arjen Poutsma added a comment - The duplicate namespace declarations are now gone. I've added a 'addNamespaceDeclaration()' method to SoapElement.
        Hide
        olegk Oleg Kalnichevski added a comment -

        Arjen,

        I apologize for being such a mess. Of course, the version Axiom I am using is 1.2.7, not 1.2.8. Stupid me. It turned out I was also unable to reproduce the problem when running the test snippet locally. The problem is perfectly reproducible, though, when code is executed inside the WebLogic Server 9.2 MP1 container. In fact, the following bit is pretty sufficient for triggering the problem.

        AxiomSoapMessageFactory messageFactory = new AxiomSoapMessageFactory();
        SoapMessage message = (SoapMessage) messageFactory.createWebServiceMessage();

        QName n1 = new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "To", "wsa");
        QName n2 = new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "Action", "wsa");

        SoapHeaderElement he1 = message.getEnvelope().getHeader().addHeaderElement(n1);
        he1.setText("whatever");
        SoapHeaderElement h2 = message.getEnvelope().getHeader().addHeaderElement(n2);

        setText("whatever");

        message.writeTo(System.out);

        I am no longer sure whether this is an Axiom issue at all, or Axiom simply ends up picking up a different implementation of some standard API when run inside an WLS container.

        Anyways, this issue has no longer anything to do with Spring WS

        > True. I will fix it, and consider that the fix of this issue, if that's OK with you.

        That would be perfectly fine with me.

        > This is actually Axiom doing it's thing. Whenever you call createSOAPFaultCode() on an Axiom SOAPFactory, it adds the namespace
        > of the code at the fault level

        I believe there is also an explicit call to SOAPFault#declareNamespace in the AxiomSoap12Fault#setValueText. I think AxiomSoapHeader#addHeaderElement ought to behave similarly.

        Thank you so much

        Oleg

        Show
        olegk Oleg Kalnichevski added a comment - Arjen, I apologize for being such a mess. Of course, the version Axiom I am using is 1.2.7, not 1.2.8. Stupid me. It turned out I was also unable to reproduce the problem when running the test snippet locally. The problem is perfectly reproducible, though, when code is executed inside the WebLogic Server 9.2 MP1 container. In fact, the following bit is pretty sufficient for triggering the problem. — AxiomSoapMessageFactory messageFactory = new AxiomSoapMessageFactory(); SoapMessage message = (SoapMessage) messageFactory.createWebServiceMessage(); QName n1 = new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "To", "wsa"); QName n2 = new QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "Action", "wsa"); SoapHeaderElement he1 = message.getEnvelope().getHeader().addHeaderElement(n1); he1.setText("whatever"); SoapHeaderElement h2 = message.getEnvelope().getHeader().addHeaderElement(n2); setText("whatever"); message.writeTo(System.out); — I am no longer sure whether this is an Axiom issue at all, or Axiom simply ends up picking up a different implementation of some standard API when run inside an WLS container. Anyways, this issue has no longer anything to do with Spring WS > True. I will fix it, and consider that the fix of this issue, if that's OK with you. That would be perfectly fine with me. > This is actually Axiom doing it's thing. Whenever you call createSOAPFaultCode() on an Axiom SOAPFactory, it adds the namespace > of the code at the fault level I believe there is also an explicit call to SOAPFault#declareNamespace in the AxiomSoap12Fault#setValueText. I think AxiomSoapHeader#addHeaderElement ought to behave similarly. Thank you so much Oleg
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        One thing you could try is to swap the StAX implementation provided by BEA with Woodstox. This probably requires setting classloading to parent-last...

        FYI: the WS-Addressing module currently spits out:

        <?xml version='1.0' encoding='UTF-8'?>
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
            <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
                <wsa:To soapenv:mustUnderstand="1">http://springframework/to</wsa:To>
                <wsa:From>
                    <wsa:Address>http://springframework/from</wsa:Address>
                </wsa:From>
                <wsa:ReplyTo>
                    <wsa:Address>http://springframework/replyTo</wsa:Address>
                </wsa:ReplyTo>
                <wsa:FaultTo>
                    <wsa:Address>http://springframework/faultTo</wsa:Address>
                </wsa:FaultTo>
                <wsa:Action>http://springframework/action</wsa:Action>
                <wsa:MessageID>http://springframework/messageId</wsa:MessageID>
            </soapenv:Header>
            <soapenv:Body/>
        </soapenv:Envelope>

        Show
        arjen.poutsma Arjen Poutsma added a comment - One thing you could try is to swap the StAX implementation provided by BEA with Woodstox. This probably requires setting classloading to parent-last... FYI: the WS-Addressing module currently spits out: <? xml version = '1.0' encoding = 'UTF-8' ?> < soapenv :Envelope xmlns:soapenv = "http://schemas.xmlsoap.org/soap/envelope/" > < soapenv :Header xmlns:wsa = "http://www.w3.org/2005/08/addressing" > < wsa :To soapenv:mustUnderstand = "1" >http://springframework/to</ wsa :To> < wsa :From> < wsa :Address>http://springframework/from</ wsa :Address> </ wsa :From> < wsa :ReplyTo> < wsa :Address>http://springframework/replyTo</ wsa :Address> </ wsa :ReplyTo> < wsa :FaultTo> < wsa :Address>http://springframework/faultTo</ wsa :Address> </ wsa :FaultTo> < wsa :Action>http://springframework/action</ wsa :Action> < wsa :MessageID>http://springframework/messageId</ wsa :MessageID> </ soapenv :Header> < soapenv :Body/> </ soapenv :Envelope>
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Resolving as fixed.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Resolving as fixed.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing old issues

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing old issues

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            olegk Oleg Kalnichevski
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: