[英]issue with Invalid UTF-8 start byte 0x8b (at char #2, byte #-1) Mule ESB
I have created Mule ESB project that invokes third party web service using web service consumer.我创建了 Mule ESB 项目,该项目使用 Web 服务使用者调用第三方 Web 服务。
Passing custom security header information using property使用属性传递自定义安全标头信息
Used transformation xslt to transform input message from source to target.使用转换 xslt 将输入消息从源转换为目标。
There is no transformation in output.输出没有转换。 Only DOM to XML node is added in output
输出中仅添加了 DOM 到 XML 节点
Can any one provide me solution on this issue?任何人都可以为我提供有关此问题的解决方案吗?
I am getting the below exception when invoking the service.调用服务时出现以下异常。
Exception stack is:
异常堆栈是:
Invalid UTF-8 start byte 0x8b (at char #2, byte #-1) (java.io.CharConversionException) com.ctc.wstx.io.UTF8Reader:303 (null)
无效的 UTF-8 起始字节 0x8b(在字符 #2,字节 #-1)(java.io.CharConversionException)com.ctc.wstx.io.UTF8Reader:303(空)
Invalid UTF-8 start byte 0x8b (at char #2, byte #-1) (com.ctc.wstx.exc.WstxIOException) com.ctc.wstx.stax.WstxInputFactory:550 (null)
无效的 UTF-8 起始字节 0x8b(在字符 #2,字节 #-1)(com.ctc.wstx.exc.WstxIOException)com.ctc.wstx.stax.WstxInputFactory:550(空)
Couldn't parse stream.
无法解析流。 (java.lang.RuntimeException) org.apache.cxf.staxutils.StaxUtils:1262 (null)
(java.lang.RuntimeException) org.apache.cxf.staxutils.StaxUtils:1262 (null)
Invalid UTF-8 start byte 0x8b (at char #2, byte #-1).
无效的 UTF-8 起始字节 0x8b(在字符 #2,字节 #-1)。
This issue may happen if that third party web service that you request to provides gzip-encoded response ie如果您请求的第三方 Web 服务提供 gzip 编码的响应,则可能会发生此问题,即
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.在这种情况下,您需要使用某种拦截器来解码响应。
To solve this, you need to intercept the response message and decode it because it's incoming in gzip encoding format, or another compression way.要解决此问题,您需要拦截响应消息并对其进行解码,因为它以gzip编码格式或其他压缩方式传入。
With CXF, it's possible to create a custom interceptor by extending the AbstractPhaseInterceptor class and overriding the handleMessage method.使用 CXF,可以通过扩展AbstractPhaseInterceptor类并覆盖handleMessage方法来创建自定义拦截器。
Then you get the message content, decode and replace it in the same content field as an InputStream .然后您获取消息内容,在与InputStream相同的内容字段中对其进行解码和替换。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.