Reputation: 11
I have an application Spring WS on Spring Boot 1.5, SAAJ-impl-1.3.28.jar. It works fine with content-type "text/xml" buy throwing the below exception for Content-Type:application/xml.
"ERROR - a.c.c.C.[.[.[.[messageDispatcherServlet] : Servlet.service() for servlet [messageDispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.ws.soap.SoapMessageCreationException: Could not create message from InputStream: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response?] with root cause com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response?"
I tried to force update content-type to "text/xml" by extending HttpServletResponseWrapper super.setContentType() in the Servlet Filter, but it didn't help. How to bypass or forceupdate the content-type so to satisfy SAAJ?
Upvotes: 1
Views: 9426
Reputation: 156
I have faced a simillar error in SOAP. Got it fixed by setting content type to
"application/soap+xml; charset=UTF-8"
Upvotes: 1
Reputation: 9154
My understanding is that the error is triggered by an incorrect content type for the incoming request. In that case, if you wanted to change it in a servlet filter, you would use an HttpServletRequestWrapper
and override getContentType()
to return the desired content type.
That being said, application/xml
is clearly not the correct content type for SOAP 1.1 and you should try to get the client fixed.
Upvotes: 0