【问题标题】:Apache Camel CXF - Error Illegal character ((CTRL-CHAR, code 31)Apache Camel CXF - 错误非法字符((CTRL-CHAR,代码 31)
【发布时间】:2019-04-28 09:02:41
【问题描述】:

我写了一个骆驼路由,它基本上是一个 https 网络服务的代理。以下是我的路线

请注意,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>

【问题讨论】:

  • 我能够找出原因(尽管不完全)。有效负载消息非常大,所以当我修剪消息并再次尝试时......所有后续调用都不会引发此错误。
  • 结束这个问题并提出另一个更相关的问题

标签: apache-camel cxf


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2020-12-15
    • 2012-08-17
    • 1970-01-01
    • 2011-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-10
    相关资源
    最近更新 更多