1

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?

2 Answers 2

1

I have faced a simillar error in SOAP. Got it fixed by setting content type to

"application/soap+xml; charset=UTF-8"
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.