title: Spring Integration WS Outbound Gateway Error : InputStream does not represent a valid SOAP 1.1 Message
body: <p>Hi I am using Spring Integration WS Outbound gateway to invoke a Soap Service. This is the WSDL:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="CreatePreadvice" targetNamespace="http://www.asda.com/CreatePreadvice/" xmlns:isd="http://www.asda.com/CreatePreadvice/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;wsdl:types&gt;
      &lt;xsd:schema targetNamespace="http://www.asda.com/CreatePreadvice/" xmlns:Q1="http://www.asda.com/PreadviceRequest"&gt;
              &lt;xsd:import schemaLocation="Preadvice.xsd" namespace="http://www.asda.com/PreadviceRequest"&gt;&lt;/xsd:import&gt;
              &lt;xsd:element name="createPreadvice"&gt;
          &lt;xsd:complexType&gt;
            &lt;xsd:sequence&gt;
              &lt;xsd:element name="CreatePreadviceRequest" type="Q1:Preadvice"/&gt;
            &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
        &lt;xsd:element name="createPreadviceResponse"&gt;
          &lt;xsd:complexType&gt;
            &lt;xsd:sequence&gt;
              &lt;xsd:element name="CreatePreadviceResponse" type="isd:Response"/&gt;
            &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
  
        &lt;xsd:complexType name="Response"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element name="ResponseCode" type="xsd:string"&gt;&lt;/xsd:element&gt;
          &lt;/xsd:sequence&gt;
        &lt;/xsd:complexType&gt;
        &lt;xsd:element name="createPreadviceFault"&gt;
          &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
  
                  &lt;xsd:element name="parcelInjectionFault"
                      type="xsd:string"&gt;
                  &lt;/xsd:element&gt;
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
        &lt;xsd:element name="createPreadviceFault1"&gt;
          &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
  
                  &lt;xsd:element name="CreatePreadviceResponse"
                      type="isd:Fault"&gt;
                  &lt;/xsd:element&gt;
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
  
        &lt;xsd:complexType name="Fault"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element name="ResponseCode" type="xsd:string"&gt;&lt;/xsd:element&gt;
              &lt;xsd:element name="Error" type="isd:Error"&gt;&lt;/xsd:element&gt;
          &lt;/xsd:sequence&gt;
        &lt;/xsd:complexType&gt;
  
        &lt;xsd:complexType name="Error"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element name="ErrorCode" type="xsd:string"&gt;&lt;/xsd:element&gt;
              &lt;xsd:element name="Description" type="xsd:string"&gt;&lt;/xsd:element&gt;
          &lt;/xsd:sequence&gt;
        &lt;/xsd:complexType&gt;
      &lt;/xsd:schema&gt;
    &lt;/wsdl:types&gt;
    &lt;wsdl:message name="createPreadviceRequest"&gt;
      &lt;wsdl:part element="isd:createPreadvice" name="parameters"/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="createPreadviceResponse"&gt;
      &lt;wsdl:part element="isd:createPreadviceResponse" name="parameters"/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="createPreadviceFault"&gt;
      &lt;wsdl:part name="parameters" element="isd:createPreadviceFault"&gt;&lt;/wsdl:part&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="createPreadviceFault1"&gt;
      &lt;wsdl:part name="parameters" element="isd:createPreadviceFault1"&gt;&lt;/wsdl:part&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:portType name="CreatePreadvice"&gt;
      &lt;wsdl:operation name="createPreadvice"&gt;
        &lt;wsdl:input message="isd:createPreadviceRequest"/&gt;
        &lt;wsdl:output message="isd:createPreadviceResponse"/&gt;
              &lt;wsdl:fault name="fault" message="isd:createPreadviceFault1"&gt;&lt;/wsdl:fault&gt;
          &lt;/wsdl:operation&gt;
    &lt;/wsdl:portType&gt;
    &lt;wsdl:binding name="CreatePreadviceSOAP" type="isd:CreatePreadvice"&gt;
      &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
      &lt;wsdl:operation name="createPreadvice"&gt;
        &lt;soap:operation soapAction="http://www.asda.com/CreatePreadvice/createPreadvice"/&gt;
        &lt;wsdl:input&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/wsdl:input&gt;
        &lt;wsdl:output&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/wsdl:output&gt;
      &lt;/wsdl:operation&gt;
    &lt;/wsdl:binding&gt;
    &lt;wsdl:service name="CreatePreadvice"&gt;
      &lt;wsdl:port binding="isd:CreatePreadviceSOAP" name="CreatePreadviceSOAP"&gt;
        &lt;soap:address location="http://161.163.98.135:60719/"/&gt;
      &lt;/wsdl:port&gt;
    &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>This is the xsd taken from wsdl types that I am using for creating mapping objects from JAXB</p>
  
  <pre><code>&lt;xsd:schema targetNamespace="http://www.asda.com/CreatePreadvice/"
          xmlns:Q1="http://www.asda.com/PreadviceRequest"
          xmlns:isd="http://www.asda.com/CreatePreadvice/" 
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
          &lt;xsd:import schemaLocation="Preadvice_new.xsd"
              namespace="http://www.asda.com/PreadviceRequest"&gt;&lt;/xsd:import&gt;
           &lt;xsd:element name="createPreadvice"&gt;
              &lt;xsd:complexType&gt;
                  &lt;xsd:sequence&gt;
                      &lt;xsd:element name="CreatePreadviceRequest" type="Q1:Preadvice" /&gt;
                  &lt;/xsd:sequence&gt;
              &lt;/xsd:complexType&gt;
          &lt;/xsd:element&gt;
          &lt;xsd:element name="createPreadviceResponse"&gt;
              &lt;xsd:complexType&gt;
                  &lt;xsd:sequence&gt;
                      &lt;xsd:element name="CreatePreadviceResponse" type="isd:Response" /&gt;
                  &lt;/xsd:sequence&gt;
              &lt;/xsd:complexType&gt;
          &lt;/xsd:element&gt;
  
          &lt;xsd:complexType name="Response"&gt;
              &lt;xsd:sequence&gt;
                  &lt;xsd:element name="ResponseCode" type="xsd:string"&gt;&lt;/xsd:element&gt;
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
          &lt;xsd:element name="createPreadviceFault"&gt;
              &lt;xsd:complexType&gt;
                  &lt;xsd:sequence&gt;
  
                      &lt;xsd:element name="parcelInjectionFault" type="xsd:string"&gt;
                      &lt;/xsd:element&gt;
                  &lt;/xsd:sequence&gt;
              &lt;/xsd:complexType&gt;
          &lt;/xsd:element&gt;
          &lt;xsd:element name="createPreadviceFault1"&gt;
              &lt;xsd:complexType&gt;
                  &lt;xsd:sequence&gt;
  
                      &lt;xsd:element name="CreatePreadviceResponse" type="isd:Fault"&gt;
                      &lt;/xsd:element&gt;
                  &lt;/xsd:sequence&gt;
              &lt;/xsd:complexType&gt;
          &lt;/xsd:element&gt;
  
          &lt;xsd:complexType name="Fault"&gt;
              &lt;xsd:sequence&gt;
                  &lt;xsd:element name="ResponseCode" type="xsd:string"&gt;&lt;/xsd:element&gt;
                  &lt;xsd:element name="Error" type="isd:Error"&gt;&lt;/xsd:element&gt;
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
  
          &lt;xsd:complexType name="Error"&gt;
              &lt;xsd:sequence&gt;
                  &lt;xsd:element name="ErrorCode" type="xsd:string"&gt;&lt;/xsd:element&gt;
                  &lt;xsd:element name="Description" type="xsd:string"&gt;&lt;/xsd:element&gt;
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
      &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>This is the spring integration configuration </p>
  
  <pre><code>&lt;int:chain input-channel="createPreadviceServiceRequestChannel"
          output-channel="createPreadviceServiceReplyChannel"&gt;
          &lt;ws:header-enricher&gt;
              &lt;ws:soap-action value="http://www.asda.com/CreatePreadvice/createPreadvice" /&gt;
          &lt;/ws:header-enricher&gt;
          &lt;ws:outbound-gateway
              uri="${returndropoff.parceldroppost.createpreadvice.stubUrl}"
              marshaller="jaxbsoapunmarshaller" unmarshaller="jaxbsoapunmarshaller" /&gt;
      &lt;/int:chain&gt;
  
  &lt;bean id="jaxbsoapunmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"&gt;
          &lt;property name="classesToBeBound"
              value="com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Preadvice,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Address,
  com.asda.connect.returnanddropoffs.dto.post.createpreadvice.ClientDetails,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Consignee,
  com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Consignment,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Consignments,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Consignor,
  com.asda.connect.returnanddropoffs.dto.post.createpreadvice.ConsumerDetails,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Contact,
  com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Container,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Containers,
  com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Contents,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Header,
  com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Message,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.ParcelAttributes,
  com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Services,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.CreatePreadvice,
  com.asda.connect.returnanddropoffs.dto.post.createpreadvice.CreatePreadviceFault,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.CreatePreadviceFault1,
  com.asda.connect.returnanddropoffs.dto.post.createpreadvice.CreatePreadviceResponse,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Error,
  com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Fault,com.asda.connect.returnanddropoffs.dto.post.createpreadvice.Response" /&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>and returndropoff.parceldroppost.createpreadvice.stubUrl is the endpoint url.Can anyone please help what is the issue.Why I am getting InputStream does not represent a valid SOAP 1.1 Message exception from WS Gateway.</p>
  
  <p>Exception Stacktrace</p>
  
  <pre><code>Caused by: javax.xml.soap.SOAPException: InputStream does not represent a valid SOAP 1.1 Message
              at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:88)
              at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:143)
              at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:189)
              ... 279 more
  </code></pre>