cSOAP call fails with 'Couldn't parse stream. Caused by: java.io.CharConversionException: Invalid UTF-8 start byte 0x8b (at char #2, byte #-1)'

Problem Description

Calling a web service with a cSOAP component fails at the response level with the following error:

java.lang.RuntimeException: Couldn't parse stream.
        at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1706)[135:org.apache.cxf.cxf-core:3.1.5]
        at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:123)[135:org.apache.cxf.cxf-core:3.1.5]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)[135:org.apache.cxf.cxf-core:3.1.5]
        at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:780)[135:org.apache.cxf.cxf-core:3.1.5]
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670)[145:org.apache.cxf.cxf-rt-transports-http:3.1.5]
...
Caused by: java.io.CharConversionException: Invalid UTF-8 start byte 0x8b (at char #2, byte #-1)
        at com.ctc.wstx.io.UTF8Reader.reportInvalidInitial(UTF8Reader.java:303)[172:woodstox-core-asl:4.4.1]
        at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:189)[172:woodstox-core-asl:4.4.1]
        at com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:250)[172:woodstox-core-asl:4.4.1]
        at com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:133)[172:woodstox-core-asl:4.4.1]
        at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:545)[172:woodstox-core-asl:4.4.1]
        ... 14 more

 

Root Cause

The "Accept-Encoding" header with the value "[gzip,deflate]" was sent with the request. Thus the external web service will send a reply using the gzip format, which the cSOAP component cannot handle/process.

 

Solution

Set the "Accept-Encoding" header with an empty value using a cSetHeader component just before the cSOAP component:

Accept-Encoding_KB.jpg

Version history
Revision #:
5 of 5
Last update:
‎08-16-2019 08:00 AM
Updated by: