users@jax-ws.java.net

Re: JWSDP 2.0 mtom soap 1.2 interoperability issue - need help

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Fri, 03 Mar 2006 10:20:32 -0800

Ray Lai wrote:
> Vivek:
>
> Thanks for your help.
>
> I follow the instruction from the provided URL to add the threshold,
> but unfortunately, there is a bindingProvider issue, before we can try
> out the getFileBinary .NET service.
>
> In the instruction, bindingProvider is an interface, and cannot be
> initialized (but it can be set to null). Once we do a
> getRequestContext(), we can define the threshold. However, I don't
> understand how the request context can be passed to the SOAPBinding or
> the remote Web service. The instruction/spec does not describe how. I
> am not sure I fully understand the instructions ('cos it seems to be
> incomplete). Could you help providing an example? (It provides a
> clear example for the server, not the client).
>
I looked at your client code and what you're doing is all that is needed
to set MTOM_THRESHOLD_VALUE. Basically you set the threshold on the
outgoing message so you set it on the RequestContext on the client and
thats what you're doing I dont see any problem there.

> I tried to scan for any sample code in the JAX-WS RI, but couldn't
> find any. The API doc is not clear how. The mtom-soap12 sample does
> not even have the threshold set.
>
I should be enhancing the user guide and mtom sample to show uese of
this property.
> Pls find my JAX-WS client source code below. You may notice that
> bindingProvider is cast to 'port'. The client program returns the same
> error messages as before.
>
As I mentioned above setting of this property looks ok to me. But I see
the problem now, port.getFileBinary("Home.jpg") does not send any binary
data I think its only String so jaxws will never MTOM encode the
message. This is how JAXWS does if the message has no binary data it
doesnt apply MTOM encoding to it. MTOM_THRESHOLD_VALUE is applied when
the message has binary data but its not above the default threahold of
1KB. This is not a problem for incoming message - jaxws can consume both
MTOM encoded or text encoded messages without any of these settings.

Can you modify your method so that client sends binary data? This is
something we have been discussing and so far we thing its inefficient to
apply MTOM encoding on the messages that has no binary data, however
.NET doesnt do that.

> I am not familiar with httpSpy or ethereal. I can google it and try to
> capture the SOAP message traffic for your diagnosis. In the meantime,
> could you advise whether I miss any item in the client program.
>
try http://www.webattack.com/get/httpspy.html.

-vivek.
> Thanks.
> rgds, ray
>
> package com.javadotnet.interop;
>
> import com.javadotnet.interop.generated.*;
> import com.sun.xml.ws.developer.JAXWSProperties;
> import java.io.FileOutputStream;
> import java.io.IOException;
> import javax.xml.ws.BindingProvider;
> import javax.xml.ws.soap.SOAPBinding;
>
> public class DotNetWSClient {
>
> private BindingProvider bindingProvider;
>
> /** Creates a new instance of DotNetWSClient */
> public DotNetWSClient() {
>
> ServiceSoap port = new Service().getServiceSoap12();
> SOAPBinding binding =
> (SOAPBinding)((BindingProvider)port).getBinding();
>
> this.bindingProvider = (BindingProvider)port;
>
> this.bindingProvider.getRequestContext().put(JAXWSProperties.MTOM_THRESHOLOD_VALUE,
> 0);
> binding.setMTOMEnabled(true);
>
> try {
> byte[] fileData = port.getFileBinary("Home.jpg");
>
> FileOutputStream fos = new
> FileOutputStream("C:\\tmp\\Home.jpg");
> fos.write(fileData);
> fos.flush();
> fos.close();
> } catch (IOException ex) {
> ex.printStackTrace();
> }
> }
>
> public static void main(String args[]) {
> new DotNetWSClient();
> }
>
> }
>
> init:
> deps-jar:
> running wsimport
> warning: SOAP port "ServiceSoap12": uses a non-standard SOAP 1.2 binding.
>
> compile:
> run:
> HTTP Status-Code 400: Bad Request
> at
> com.sun.xml.ws.transport.http.client.HttpClientTransport.checkResponseCode(HttpClientTransport.java:300)
>
> at
> com.sun.xml.ws.transport.http.client.HttpClientTransport.getHeaders(HttpClientTransport.java:153)
>
> at
> com.sun.xml.ws.util.SOAPConnectionUtil.getSOAPMessage(SOAPConnectionUtil.java:58)
>
> at
> com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder.toSOAPMessage(SOAPXMLDecoder.java:97)
>
> at
> com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:459)
>
> at
> com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:291)
>
> at
> com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:157)
>
> at
> com.sun.xml.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:85)
>
> at
> com.sun.xml.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocationHandler.java:177)
>
> at
> com.sun.xml.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.java:105)
>
> at $Proxy24.getFileBinary(Unknown Source)
> at
> com.javadotnet.interop.DotNetWSClient.<init>(DotNetWSClient.java:34)
> at
> com.javadotnet.interop.DotNetWSClient.main(DotNetWSClient.java:46)
> Exception in thread "main" javax.xml.ws.WebServiceException: HTTP
> Status-Code 400: Bad Request
> at
> com.sun.xml.ws.util.SOAPConnectionUtil.getSOAPMessage(SOAPConnectionUtil.java:82)
>
> at
> com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder.toSOAPMessage(SOAPXMLDecoder.java:97)
>
> at
> com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:459)
>
> at
> com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:291)
>
> at
> com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:157)
>
> at
> com.sun.xml.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:85)
>
> at
> com.sun.xml.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocationHandler.java:177)
>
> at
> com.sun.xml.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.java:105)
>
> at $Proxy24.getFileBinary(Unknown Source)
> at
> com.javadotnet.interop.DotNetWSClient.<init>(DotNetWSClient.java:34)
> at
> com.javadotnet.interop.DotNetWSClient.main(DotNetWSClient.java:46)
> Caused by: HTTP Status-Code 400: Bad Request
> at
> com.sun.xml.ws.transport.http.client.HttpClientTransport.checkResponseCode(HttpClientTransport.java:300)
>
> at
> com.sun.xml.ws.transport.http.client.HttpClientTransport.getHeaders(HttpClientTransport.java:153)
>
> at
> com.sun.xml.ws.util.SOAPConnectionUtil.getSOAPMessage(SOAPConnectionUtil.java:58)
>
> ... 10 more
> Java Result: 1
> BUILD SUCCESSFUL (total time: 7 seconds)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>

-- 
Vivek Pandey
Web Services Standards and Technologies
Sun Microsystems Inc.