[英]camel cxf client soap fault handling
我正在使用camel和cxf組件從web服務獲取一些數據。 在某些情況下,web-service返回標准soap:fault。 我有接下來的步驟:
<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>
其中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>
如果我得到正常的肥皂信息一切都好。 當我得到肥皂foalt / http 500我只有字符串消息,其中包含肥皂消息(xml)與肥皂錯誤。
閱讀cxf和camel郵件列表上的類似問題我理解cxf端點應該拋出異常,如果有soap foalt,類型為org.apache.cxf.binding.soap.SoapFault的異常,但我無法得到它。 目標是onException子句來處理soap fault異常。
有什么建議么?
您正在使用MESSAGE數據格式,這意味着camel-cxf端點只是從傳輸中傳遞流,它不會讀取下層消息,因此camel-cxf端點無法分辨哪條消息是正常的soap消息還是soap故障消息。
如果你想讓camel路由處理soap故障,你需要使用PAYLOAD或POJO數據格式。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.