Apache Camel CXF-错误非法字符((CTRL-CHAR,代码31)

时间:2018-11-26 17:01:32

标签: apache-camel cxf

我写了一条骆驼路线,该路线基本上是https Web服务的代理。以下是我的路线

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

<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.transport.common.gzip.GZIPFeature"/>
    </cxf:features>
    <cxf:inInterceptors>
        <bean class="org.apache.cxf.transport.common.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.org/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调用端点时,第一次调用总是成功的,我得到一个有效的响应。

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

<soap:Fault>
         <faultcode xmlns:ns0="http://schemas.xmlsoap.org/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>

1 个答案:

答案 0 :(得分:0)

此问题是由于有效负载大小过大引起的。提出另一个问题,以寻求在使用Apache Camel时使用大型SOAP负载的帮助。

相关问题