Reputation: 1049
I have a Spring-WS web service (SOAP 1.2 MTOM) deployed as part of a large application (on Weblogic) returning incorrect Content-Type (Consumer doesn't like it). The Content-Type is
Content-Type: multipart/related;boundary="----=_Part_1_4569975.1498510764791";type="text/xml";start="<soapPart>"
I have another lean model service that I have deployed on TomEE returning it this way (Consumer likes it) -
Content-Type: Multipart/Related; boundary="----=_Part_4_1924421953.1498510734751"; type="application/xop+xml"; start-info="application/soap+xml"
What could be wrong on the first service. Where is the configuration that ensures the right Content-Type?
Update (after 5 days) -
I have narrowed it down to the same exact WAR file returning content-type "text/xml" on Weblogic (10.3.6) and "application/xop+xml" on TomEE 1.7.4. Anyone can tell me what could be the difference between these environments? How can I make the application return the right content type on Weblogic?
Upvotes: 0
Views: 737
Reputation: 1
I too faced the same problem and, by using the below code, I was able to overcome this:
SaajSoapMessage saajSoapMessage = (SaajSoapMessage) message;
if (soapAction != null) {
saajSoapMessage.setSoapAction(soapAction);
}
try {
SOAPMessage soapMessage = saajSoapMessage.getSaajMessage();
MimeHeaders headers = soapMessage.getMimeHeaders();
headers.removeHeader(TransportConstants.HEADER_CONTENT_TYPE);
headers.addHeader(TransportConstants.HEADER_CONTENT_TYPE, "application/soap+xml;charset=utf-8");
}catch(Exception e)
{
//log
}
Upvotes: 0
Reputation: 9154
The difference between these two environments will be the SAAJ implementation. TomEE will likely use the one in the JRE, while Weblogic has its own SAAJ implementation. Instead of using Spring-WS with SAAJ, you may want to try configuring it with Axiom.
Upvotes: 0