jax-wscontent-typemimemtomxop

Rewriting "Content-Type" header and MIME boundaries with JAX-WS and MTOM/XOP


I have a specification I need to comply with, which makes some rather unusual demands (for historical reasons) when providing and using a Web Service using MTOM/XOP:

To summarize, the Content-Type HTTP Header has to be coded like this: The start-info and action have to be coded as separate parameters of Content-Type: start-info="application/soap+xml";action="urn:ihe:iti:2007:RetrieveDocumentSet"

Content-Type: multipart/related;start="...";type="application/xop+xml";boundary="...";start-info="application/soap+xml;action=\"urn:ihe:iti:2007:RetrieveDocumentSet\""

The same applies to the MIME boundaries sent with the web service message.

Java7 and Java8's included JAX-WS implementation seem to handle this differently, i.e.: Java7 does the encoding as expected by the specification I need to comply with, while Java8 does it according to the MTOM/XOP specification. I cannot go back to Java8 because other libraries I am using need Java8

Is there a way of modifying JAX-WS's behaviour, or of intercepting and changing the headers / MIME boundaries before reaching the other system?


Solution

  • Meanwhile, we found an answer: It is possible to use a custom TubeFactory in the application. This can then return a standard HttpTransportPipe with a modified Codec implementation, which modifies the Content-Type header in the getStaticContentType(Packet) method.