0

I'm using camel and cxf component to get some data from web-service. In some case web-service returns standard 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:

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

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. The goal is onException clause do handling of soap fault exception.

Any suggestions?

4

1 回答 1

2

您使用的是 MESSAGE 数据格式,这意味着camel-cxf端点只是从传输中传递流,它不会读取底层消息,因此camel-cxf端点无法分辨哪个消息是正常soap消息或soap故障消息.

如果想让骆驼路线处理soap故障,需要使用PAYLOAD或POJO数据格式。

于 2013-08-18T13:25:01.413 回答