Apache Camel CXF

编程入门 行业动态 更新时间:2024-10-26 16:32:51
本文介绍了Apache Camel CXF - 错误非法字符((CTRL-CHAR,代码 31)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我写了一个骆驼路由,它基本上是一个 https Web 服务的代理.下面是我的路线

I have written a camel route that is basically a proxy for an https web service. Below is my route

请注意 https 服务以 gzip 编码响应!!

Please note that the https service responds with gzip encoding !!

<camel:sslContextParameters id="sslContext">
    <camel:trustManagers>
        <camel:keyStore resource="certificates/cert.jks" type="jks"
                        password="test"/>
    </camel:trustManagers>
</camel:sslContextParameters>
<cxf:cxfEndpoint id="source"
                 wsdlURL="wsdl/SampleService.wsdl"
                 serviceClass="com.sample"
                 address="http://localhost:9000/SampleService">
    <cxf:properties>
        <entry key="dataFormat" value="PAYLOAD"/>
    </cxf:properties>
</cxf:cxfEndpoint>
<cxf:cxfEndpoint id="target"
                 wsdlURL="wsdl/target.wsdl"
                 serviceClass="com.sample1"
                 address="https://endpoint">
    <cxf:properties>
        <entry key="dataFormat" value="PAYLOAD"/>
    </cxf:properties>
    <cxf:features>
        <bean class="org.apache.cxf.transportmon.gzip.GZIPFeature"/>
    </cxf:features>
    <cxf:inInterceptors>
        <bean class="org.apache.cxf.transportmon.gzip.GZIPInInterceptor"/>
    </cxf:inInterceptors>

</cxf:cxfEndpoint>

<bean id="headerProcessor" class="com.sample.HeaderProcessor"/>

<bean id="defaultHostnameVerifier" class="com.sample.customHostNameVerifier"/>
<camel:camelContext xmlns="http://camel.apache/schema/spring" id="vediContext" streamCache="true">
    <onException>
        <exception>org.apache.cxf.binding.soap.SoapFault</exception>
        <redeliveryPolicy maximumRedeliveries="0" redeliveryDelay="2000"/>
    </onException>
    <camel:route>
        <camel:from uri="cxf:bean:source"/>
        <camel:to uri="cxf:bean:target?sslContextParameters=#sslContext&amp;hostnameVerifier=#defaultHostnameVerifier">
        </camel:to>

    </camel:route>
</camel:camelContext>

使用此路由,当我通过 SOAP UI 调用端点时,第一次调用总是成功,我得到有效响应.

With this route, when I invoke the endpoint via SOAP UI, the first invocation is always successful, I get a valid response.

对于此后的任何调用,我总是收到以下异常:

For any invocation after that, I always get the following exception :

<soap:Fault>
         <faultcode xmlns:ns0="http://schemas.xmlsoap/soap/envelope/">ns0:Client</faultcode>
         <faultstring>Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 31))
 at [row,col {unknown-source}]: [1,1]</faultstring>
      </soap:Fault>

推荐答案

此问题是由于有效负载非常大而引起的.在使用 Apache Camel 时提出另一个问题以寻求有关处理大型 SOAP 有效负载的帮助.

This issue was caused due to the payload size being pretty big. Raising another question to seek help around working with large SOAP payloads when working with Apache Camel.

这篇关于Apache Camel CXF - 错误非法字符((CTRL-CHAR,代码 31)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-19 21:58:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/971488.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Apache   Camel   CXF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!