I'm sending a file via a DataHandler using MTOM.
I expected to see something like the SOAP message in the JAX-WS
documentation for MTOM (SOAPBody contains an xop:Include statement
referencing the binary data by content id), but my SOAP message has
(massive amount of / 2MB of) binary data dropped into the SOAP Envelope.
Any ideas what I'm doing wrong?
The WebService looks like this:
@MTOM
@WebService()
@HandlerChain( file="handlers.xml")
public class GSWebService2 {
@WebMethod()
public String putStreamingFileMTOM(@XmlMimeType("*/*")DataHandler
dh, String filename) {}
}
The xsd includes this:
<xs:complexType name="putStreamingFileMTOM">
<xs:sequence>
<xs:element name="arg0" ns1:expectedContentTypes="*/*"
type="xs:base64Binary" minOccurs="0"/>
<xs:element name="arg1" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
My stub function looks like this:
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "putStreamingFileMTOM", targetNamespace
= "
http://GroupService.company.com/", className =
"com.company.groupservice.PutStreamingFileMTOM")
@ResponseWrapper(localName = "putStreamingFileMTOMResponse",
targetNamespace = "
http://GroupService.company.com/", className =
"com.company.groupservice.PutStreamingFileMTOMResponse")
public String putStreamingFileMTOM(
@WebParam(name = "arg0", targetNamespace = "")
DataHandler arg0,
@WebParam(name = "arg1", targetNamespace = "")
String arg1);
I'm creating my service port like so (zero to force MTOM to use
attachments, same result without it):
GSWebService2 proxy = service.getGSWebService2Port(new
MTOMFeature(0));
I'm making my call like so:
String res =
proxy.putStreamingFileMTOM(getDataHandler("bafishe_www.zip"),"bafishe_ww
w.zip");
The HTTP content looks like this (I snipped it off after a bit of
encoded binary data, I've never been patient enough with my logging
tools to get to arg1):
POST /Java6WS/GSWebService2 HTTP/1.1
SOAPAction: ""
Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg,
*; q=.2, */*; q=.2
Content-Type:
multipart/related;type="application/xop+xml";boundary="uuid:8d3575b3-6e6
a-4b58-9365-037a1ef55c75";start-info="text/xml"
User-Agent: Java/1.6.0
Host: localhost:8081
Connection: keep-alive
Transfer-Encoding: chunked
ffb
--uuid:8d3575b3-6e6a-4b58-9365-037a1ef55c75
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version="1.0" ?><S:Envelope
xmlns:S="
http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:putStre
amingFileMTOM
xmlns:ns2="
http://GroupService.company.com/"><arg0>UEsDBAoAAAAAAERROC4AA
AAAAAAAAAAAAAAEABUAd3d3L1VUCQADb3MxPncG2kRVeAQAhlD0AVBLAwQKAAAAAAASXZQtA
AAAAAAAAAAAAAAACAAVAHd3dy9DVlMvVVQJAAMkZAM+dgbaRFV4BACGUPQBUEsDBAoAAAAAA
KWCky1...