users@jax-ws.java.net

Re: MTOM inlining large amounts of data

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Thu, 19 Apr 2007 16:00:30 -0700

Do you have handler on the client side? When you have MTOM enabled and
there is Handler, sine the Message is converted in to SOAPMessage and
the binary data is anyway inlined in to the SOAPMessage we dont again
covert them back to the attachments. This defeats the purpose of MTOM
optimization.

-vivek.


Fisher, Brice A wrote:
>
> 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/_
> <http://GroupService.company.com/>", className =
> "com.company.groupservice.PutStreamingFileMTOM")
>
> @ResponseWrapper(localName = "putStreamingFileMTOMResponse",
> targetNamespace = "_http://GroupService.company.com/_
> <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_www.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-6e6a-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:putStreamingFileMTOM
> xmlns:ns2="http://GroupService.company.com/"><arg0>UEsDBAoAAAAAAERROC4AAAAAAAAAAAAAAAAEABUAd3d3L1VUCQADb3MxPncG2kRVeAQAhlD0AVBLAwQKAAAAAAASXZQtAAAAAAAAAAAAAAAACAAVAHd3dy9DVlMvVVQJAAMkZAM+dgbaRFV4BACGUPQBUEsDBAoAAAAAAKWCky1…
>
>