Version 1

    How to send SOAP 1.1 envelopes using JBossWS

     

    Most commonly used envelope binding nowadays is SOAP 1.2. What if you have that legacy web service to which you need to send only a SOAP 1.1 envelope? Well here is the answer.

     

    Dynamic Proxy Clients:

     

    JBossWS by default uses SOAP 1.2 in clients that use native stack version 3.x and above. In order to make your Dynamic Proxy clients to send a SOAP 1.1 envelope with the NS "http://schemas.xmlsoap.org/soap/envelope" all you have to do is make sure the Interface class is annotated with BindingType of the desired NS Id.

     

    import javax.jws.WebService;
    import javax.xml.ws.BindingType;

    @WebService(name="Hello", targetNamespace="http://org.jboss.ws/samples/bindings")
    @BindingType(javax.xml.ws.soap.SOAPBinding.
    SOAP11HTTP_BINDING)
    public interface Hello
    {
         public String echo(String user);
    }

     

    So in the client by setting this Interface class as the parameter to the port would ensure your envelope is sent as SOAP 1.1 format.

     

    Service service = Service.createService(wsdlLocation, serviceQName);
    Hello port = (Hello)service.getPort(Hello.class);