issue with Invalid UTF-8 start byte 0x8b (at char #2, byte #-1) Mule ESB

JP123 picture JP123 · Feb 7, 2016 · Viewed 9.8k times · Source

I have created Mule ESB project that invokes third party web service using web service consumer.

Passing custom security header information using property

Used transformation xslt to transform input message from source to target.

There is no transformation in output. Only DOM to XML node is added in output

Can any one provide me solution on this issue?

I am getting the below exception when invoking the service.

Exception stack is:

  1. Invalid UTF-8 start byte 0x8b (at char #2, byte #-1) (java.io.CharConversionException) com.ctc.wstx.io.UTF8Reader:303 (null)

  2. Invalid UTF-8 start byte 0x8b (at char #2, byte #-1) (com.ctc.wstx.exc.WstxIOException) com.ctc.wstx.stax.WstxInputFactory:550 (null)

  3. Couldn't parse stream. (java.lang.RuntimeException) org.apache.cxf.staxutils.StaxUtils:1262 (null)

  4. Invalid UTF-8 start byte 0x8b (at char #2, byte #-1).

Answer

dmitry747 picture dmitry747 · Sep 8, 2016

This issue may happen if that third party web service that you request to provides gzip-encoded response i.e.

HTTP/1.1 200 OK
Content-Type: text/xml;charset="utf-8"
Content-Encoding: gzip
Content-Length: 324

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>...

In this case you need to use some kind of interceptor that decodes the response.