Closed mwyrembl closed 4 years ago
In our MTOM sample, the incoming enclosing request from the client is: Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
, the same as yours.
Not quite sure what is breaking. Do you control the server? And how is your client different from our sample client?
It seems that the problem is not the request but the response from the server. It has a Content-Type of:
Content-Type: multipart/related;type="application/xop+xml"; start="
Because it responds with a MTOM message as well. But in the JRE there is a check in com.sun.xml.internal.messaging.saaj.soap.MessageImpl.identifyContentType that throws this exception because it expects the type to be text/xml or application/soap+xml but it is actually application/xop+xml.
Is it not allowed to get a MTOM response from the server or do you have an example for a web service client that sends a MTOM message and also receives a MTOM message as a response?
The probem is that the server does not send the "start-info" Parameter in the Content-Type. That's why the check in "isMimeMultipartXOPSoap1_1Package" returns false and the last else branch throws the exception then. I have to check that with the service provider of the web service.
I am getting the following exception when trying to use MTOM in my web service client:
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Content-Type needs to be Multipart/Related and with "type=text/xml" or "type=application/soap+xml" at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.identifyContentType(MessageImpl.java:629) at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.(MessageImpl.java:301)
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl.(Message1_1Impl.java:65)
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.createMessage(SOAPMessageFactory1_1Impl.java:63)
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:190)
... 86 common frames omitted
The message looks like this:
[13.08.2020 10:32:02.320][https-jsse-nio-9998-exec-6 ][DEBUG][WebServiceAccessor.createConnection:111 ] Opening [org.springframework.ws.transport.http.HttpComponentsConnection@767912eb] to [http://localhost:9080/soap/services/FormsService?blob=mtom] [13.08.2020 10:32:02.397][https-jsse-nio-9998-exec-6 ][TRACE][WebServiceTemplate.sendRequest:653 ] Sent request [------=_Part_0_1137162597.1597307522369 Content-Type: application/xop+xml; charset=utf-8; type="text/xml"