title: Invalid UTF-8 start byte 0x8b error calling a SOAP service after receiving result of a REST call - WSO2 ESB 4.8.1
body: <p>Implementing a service chain in WSO2 ESB 4.8.1 we have a sequence that calls a REST service and in the receiving sequence we call a SOAP service. In doing so, we get the following error, </p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;S:Body&gt;&lt;ns2:Fault xmlns:ns3="http://www.w3.org/2003/05/soap-envelope" xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;faultcode&gt;ns2:Client&lt;/faultcode&gt;
  &lt;faultstring&gt;Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 start byte 0x8b (at char #2, byte #-1)&lt;/faultstring&gt;
  &lt;/ns2:Fault&gt;
  &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;[\r][\n]" {org.apache.synapse.transport.http.wire}
  </code></pre>
  
  <p>This happens irrespective of whether we use the result of the previous call as input or even when actual values are hard-coded in the PayloadFactory. Moreover the SOAP service never receives the request. </p>
  
  <p>When the SOAP service is called on it's own through the ESB or through soapUI, it works fine.</p>
  
  <p>The sequence that calls the SOAP service is as follows,</p>
  
  <pre><code>&lt;template xmlns="http://ws.apache.org/ns/synapse" name="tmpl_get_customer_details"&gt;
     &lt;sequence&gt;
        &lt;payloadFactory media-type="xml"&gt;
           &lt;format&gt;
              &lt;getCustomer xmlns="http://customer.frontend.ws.utilibill.com.au/"&gt;
                 &lt;customer xmlns=""&gt;
                    &lt;custNo&gt;12965&lt;/custNo&gt;
                 &lt;/customer&gt;
                 &lt;login xmlns=""&gt;
                    &lt;password&gt;password&lt;/password&gt;
                    &lt;userName&gt;username&lt;/userName&gt;
                 &lt;/login&gt;
              &lt;/getCustomer&gt;
           &lt;/format&gt;
           &lt;args&gt;
              &lt;arg xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" expression="$ctx:utilibill_customer_number" evaluator="xml"&gt;&lt;/arg&gt;
           &lt;/args&gt;
        &lt;/payloadFactory&gt;
        &lt;log level="full"&gt;
           &lt;property name="POSITION" value="tmpl_get_customer_details"&gt;&lt;/property&gt;
        &lt;/log&gt;
        &lt;header name="Action" scope="default" value="http://customer.frontend.ws.utilibill.com.au/UtbCustomer/getCustomerRequest"&gt;&lt;/header&gt;
        &lt;header name="To" scope="transport" value="http://customer.frontend.ws.utilibill.com.au/UtbCustomer/getCustomerRequest"&gt;&lt;/header&gt;
        &lt;property name="POST_TO_URI" value="true" scope="axis2" type="STRING"&gt;&lt;/property&gt;
        &lt;log level="full"&gt;
           &lt;property name="POSITION" value="CALLING_CUSTOMER_SERVICE"&gt;&lt;/property&gt;
        &lt;/log&gt;
        &lt;send receive="seq_get_services"&gt;
           &lt;endpoint key="UtbCustomer"&gt;&lt;/endpoint&gt;
        &lt;/send&gt;
     &lt;/sequence&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>Can anyone please point out what maybe causing this?</p>