users@jax-ws.java.net

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

From: Ray Lai <Ray.Lai_at_Sun.COM>
Date: Wed, 01 Mar 2006 23:00:32 -0800

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 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.

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.

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.

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)