I have to call a Microsoft WebService from a Java Client. Client-side I'm using Apache CXF (because it's simple to use SSO over Ntlm ... that's a requirement, so please don't tell me to use Axis 2 or other frameworks ... evaluated moste of them ; - ). There're no problems using simple methods without attachements.
Now we have to store binary data (protocols) via the service into a database (yeah, I know we could do that directly ...). We decided to use MTOM because it seems to be covered on both sides. But it seems it's not that easy.
First of all the WSDL2Java generator doesn't generate the correct Code (with DataHandler), but a simple byte array. It seems that for the generator the element not only needs to be type="xs:base64Binary" but also xmime:expectedContentTypes="application/octet-stream". I have absolutely no idea how to reach this form WCF side (MSDN doesn't offer that much info for unexperienced users like me).
So I decided to adapt the generated classes and add the annotation (@XmlMimeType("application/octet-stream")) and DataSource manually (instead of the byte array). Also I set the key "mtom-enabled" to "true" for the endpoint. So the message is really multipart. Sadly I get only a Http status code 400 from the service:
According to the description in MSDN the "multipart/related", "application/xop+xml" and "application/soap+xml" should be correct. So the only possible failure (in my opinion) must be something with the boundary. Does anyone know how to configure the boundary settings ... is there a possibility?
Btw. it's interesting that if I disable MTOM on the client side (and the message isn't multipart anymore) I don't get a 400 error but a Http OK (200):
The configrutation on the client-side atm is hardcoded (simplified):