Invalid message created when using MTOM and WS-RM
-------------------------------------------------
Key: CXF-2318
URL: https://issues.apache.org/jira/browse/CXF-2318
Project: CXF
Issue Type: Bug
Components: WS-* Components
Affects Versions: 2.2.2
Reporter: Guillaume Porcher
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="<[email protected]>"; 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: <[email protected]>
--uuid:d861ffd6-2559-491d-b995-4420ac2e99e0
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <d027f743-11a2-45e8-b95e-592f8b751bb...@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
<[email protected]> 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.