Apache Camel CXF - Error Illegal character ((CTRL-CHAR, code 31)

[亡魂溺海] 提交于 2019-12-11 17:17:12

问题


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

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.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>

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.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:


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.



来源:https://stackoverflow.com/questions/53485834/apache-camel-cxf-error-illegal-character-ctrl-char-code-31

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!