简体   繁体   English

camel cxf客户端肥皂故障处理

[英]camel cxf client soap fault handling

I'm using camel and cxf component to get some data from web-service. 我正在使用camel和cxf组件从web服务获取一些数据。 In some case web-service returns standard soap:fault. 在某些情况下,web-service返回标准soap:fault。 I have the next steps: 我有接下来的步骤:

<camel:route id="someId">
    <camel:onException useOriginalMessage="false">
            <camel:exception>java.lang.Exception</camel:exception>
            <camel:handled>
                <camel:constant>false</camel:constant>
            </camel:handled>
            <camel:process ref="defaultNaoIntegrationErrorHandler" />
            <camel:to uri="ref:naointegration.checkAvailability.jms.error.queue" />
    </camel:onException>
    <camel:from uri="direct:naoCheckAvailabilityOut" />
    <camel:marshal ref="soapjaxbSAP" />
    <camel:to id="naoCheckAvailabilityEndpoint" uri="cxf:bean:naoCheckAvailabilityEndpoint" />
    <camel:unmarshal ref="soapjaxbSAP" />
</camel:route>

where naoCheckAvailabilityEndpoint is: 其中naoCheckAvailabilityEndpoint是:

<cxf:cxfEndpoint id="naoCheckAvailabilityEndpoint"
        address="${naointegration.I011.CheckAvailability.soap.address}"
        endpointName="s:checkAvailabilityEndpoint" serviceName="s:SOAPService"
        xmlns:s="http://www.example.com/test">
        <cxf:properties>
            <entry key="dataFormat" value="MESSAGE" />
            <entry key="setDefaultBus" value="true" />
        </cxf:properties>
        <cxf:outInterceptors>
            <ref bean="logOutbound" />
        </cxf:outInterceptors>

        <cxf:inFaultInterceptors>
            <ref bean="logOutbound" />
        </cxf:inFaultInterceptors>
    </cxf:cxfEndpoint>

If I'm getting normal soap message everything is ok. 如果我得到正常的肥皂信息一切都好。 And when I'm getting soap foalt/http 500 I have just string message which contains soap message (xml) with soap fault. 当我得到肥皂foalt / http 500我只有字符串消息,其中包含肥皂消息(xml)与肥皂错误。

Reading cxf and camel mail lists on like problems I understood cxf endpoint should throw exception if there soap foalt, exception of type org.apache.cxf.binding.soap.SoapFault, but I can not get it. 阅读cxf和camel邮件列表上的类似问题我理解cxf端点应该抛出异常,如果有soap foalt,类型为org.apache.cxf.binding.soap.SoapFault的异常,但我无法得到它。 The goal is onException clause do handling of soap fault exception. 目标是onException子句来处理soap fault异常。

Any suggestions? 有什么建议么?

You are using the MESSAGE data format, which means the camel-cxf endpoint just pass the stream from the transport, it will not read the under layer message, so the camel-cxf endpoint cannot tell which message is normal soap message or soap fault message. 您正在使用MESSAGE数据格式,这意味着camel-cxf端点只是从传输中传递流,它不会读取下层消息,因此camel-cxf端点无法分辨哪条消息是正常的soap消息还是soap故障消息。

If you want to let the camel route deal with the soap fault, you need to use the PAYLOAD or POJO data format. 如果你想让camel路由处理soap故障,你需要使用PAYLOAD或POJO数据格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM