Monday, November 21, 2011

IBM JAX-WS JAXB Troubles and Work Around

So one of my recent projects involved sending some data to a SOAP service. Something I took to be trivial. It was until the requirement of MTOM bindings, SAML assertions and a huge schema came into play.

IBM WebSphere 6.1 (WAS) doesn't support MTOM so we had to use WAS 8.

Then I hit this wonderful error:

Caused by: java.lang.ClassCastException: incompatible with javax.xml.bind.JAXBElement
 at ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType_JAXB_Serialization_Stub.write(

After a ticket with IBM I finally received the workaround after 3 weeks.

Set the following custom JVM property = 0

For those who do not know how to set custom properties: