When using saaj as a client (SAOPConnection.call(...)), if the response is in
mtom format, soap 1.1 will always be used to parse the envelope, even though it
should be soap 1.2.
First, spec references:
The initial mtom spec says to use mtom with soap 1.2. The start-info parameter
of the Content-Type header must be "application/soap+xml", corresponding to the
content type of a plain soap 1.2 message. Saaj parses this correctly and
realizes that the message is mtom formatted.
The spec for using mtom with soap 1.1 says that they the start-info parameter
must be "text/xml", corresponding to the content type of a plain soap 1.1
message. Saaj cannot parse this and throws an exception if it comes across this.
InputStream) is called to parse the input stream of a soap response (where
MessageFactoryImpl is in this case a super class for a
SOAPMessageFactoryDynamicImpl object). The createMessage method properly
figures out that the http body is in mtom format (the "stat" variable).
However, when it checks to see if this means that the soap payload is soap 1.1,
the answer is true and it proceeds to try to parse a soap 1.1 message, even
though, as shown above, the message must be soap 1.2.
The quick fix for this, I believe, is to change the value of
com.sun.xml.messaging.saaj.soap.MessageImpl.MIME_MULTIPART_XOP_FLAG from 14 to
10 (flip the 3rd bit to specify that soap 1.1 is not supported with mtom/xop).
A fuller fix would be to differentiate between soap 1.1 and 1.2 according to the
spec referenced above (introduce a new flag, properly recognize
start-info="text/xml" and choose the correct SOAPMessage implementation based on
If there is interest, I could certainly work on this.