Java camel cxf客户端soap故障处理
我使用camel和cxf组件从web服务获取一些数据。在某些情况下,web服务返回标准soap:fault。 我有以下步骤:Java camel cxf客户端soap故障处理,java,soap,cxf,apache-camel,Java,Soap,Cxf,Apache Camel,我使用camel和cxf组件从web服务获取一些数据。在某些情况下,web服务返回标准soap:fault。 我有以下步骤: <camel:route id="someId"> <camel:onException useOriginalMessage="false"> <camel:exception>java.lang.Exception</camel:exception> <cam
<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>
java.lang.Exception
假的
其中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>
如果我收到正常的soap消息,一切都正常。当我得到soapfoalt/http500时,我只有一个字符串消息,它包含带有soap错误的soap消息(xml)
阅读关于类似问题的cxf和驼峰邮件列表,我理解cxf端点应该在存在soap foalt时引发异常,类型为org.apache.cxf.binding.soap.SoapFault的异常,但我无法获得它。
目标是OneException子句处理soap错误异常
有什么建议吗?您使用的是消息数据格式,这意味着camel cxf端点只是从传输中传递流,它不会读取底层消息,因此camel cxf端点无法判断哪条消息是正常的soap消息还是soap错误消息 如果希望让驼峰路由处理soap故障,则需要使用有效负载或POJO数据格式