Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-2318

Invalid message created when using MTOM and WS-RM

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.2
    • 2.0.12, 2.1.6, 2.2.3
    • WS-* Components
    • None

    Description

      When using WS-RM and MTOM, the generated message content is:

      POST /services/SayHello HTTP/1.1

      Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:d861ffd6-2559-491d-b995-4420ac2e99e0"; start="<root.message@cxf.apache.org>"; start-info="application/soap+xml"

      Accept: /

      User-Agent: Apache CXF 2.2.2

      Cache-Control: no-cache

      Pragma: no-cache

      Host: localhost:12345

      Connection: keep-alive

      Content-Length: 1619

      --uuid:d861ffd6-2559-491d-b995-4420ac2e99e0

      Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml";

      Content-Transfer-Encoding: binary

      Content-ID: <root.message@cxf.apache.org>

      --uuid:d861ffd6-2559-491d-b995-4420ac2e99e0

      Content-Type: application/octet-stream

      Content-Transfer-Encoding: binary

      Content-ID: <d027f743-11a2-45e8-b95e-592f8b751bb4-1@http://cxf.apache.org/>

      attachment content

      -uuid:d861ffd6-2559-491d-b995-4420ac2e99e0-<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><Action xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://example.com/sayHello/ISayHello/hello</Action><MessageID xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">urn:uuid:a2a9917b-4579-4945-aa38-e0da657dbbb4</MessageID><To xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://localhost:12345/services/SayHello</To><ReplyTo xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address></ReplyTo><wsrm:Sequence xmlns:ns2="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"><wsrm:Identifier>urn:uuid:b5383bf0-2444-4af8-b923-146d02610ab5</wsrm:Identifier><wsrm:MessageNumber>1</wsrm:MessageNumber></wsrm:Sequence></soap:Header><soap:Body><ns1:hello xmlns:ns1="http://example.com/sayHello"><arg0>john</arg0><arg1><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:d027f743-11a2-45e8-b95e-592f8b751bb4-1@http%3A%2F%2Fcxf.apache.org%2F"/></arg1></ns1:hello></soap:Body></soap:Envelope>

      The soap envelope is sent after the last attachment instead of being in the <root.message@cxf.apache.org> part.

      This bug seems to be caused by :
      1- the AttachmentOutInterceptor writes the prolog by using the current message outputstream (OS1)
      2- the RetransmissionInterceptor wraps the message outputstream in a WriteOnCloseOutputStream (OS2)
      3- the soap envelope is written in the current message outputsream OS2.
      4- the attachments are written in the outputstream OS1 used to write the prolog.
      5- the WriteOnCloseOutputstream OS2 is closed, and the soap envelope is appended in the wrapped outputstream OS1.

      Setting the RetransmissionInterceptor to be before AttachmentOutInterceptor in the interceptor chain seems to solve this issue.

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            porcherg Guillaume Porcher
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: