[英]How to create a soap fault with apache camel spring-ws
以下場景適用於Apache駱駝2.14.0,spring-ws 1.5.9和公理1.2.9
場景 -調用我們的soap服務時,它應該可選地返回一個錯誤-此錯誤應作為soap錯誤在響應中
問題檢測
我已經檢測到問題:-Spring-WS的org.springframework.ws.soap.axiom.AxiomHandler(2.3.0)不會創建SOAPFault對象-org.apache.axiom.soap.impl.llom.SOAPBodyImpl(1.2 .15)不再檢查元素的本地名稱
問題是否有更好的方法來處理apache駱駝的肥皂毛病?
摘錄下面是駱駝配置的片段
<camel:from uri="spring-ws:uri:/contextPath/soapServices?endpointMapping=#endpointMapping"/>
<camel:to uri="bean:someBean" />
<camel:choice>
<camel:when>
<camel:xpath>//error</camel:xpath>
<camel:to uri="xslt:transform_event_response_to_soapfault.xslt?saxon=true" />
</camel:when>
</camel:choice>
</camel:from>
我們使用no的解決方案如下:將原始消息存儲在標頭中並引發異常。 spring-ws組件將自動將其轉換為肥皂故障。 還添加CamelFailuerHandled,以便錯誤消息不在日志文件中。
<camel:setHeader headerName="myErrorMessage">
<camel:xpath>//error/text()</camel:xpath>
</camel:setHeader>
<camel:setProperty propertyName="CamelFailureHandled">
<camel:constant>true</camel:constant>
</camel:setProperty>
<camel:throwException exceptionType="java.lang.IllegalArgumentException" message="${header.myErrorMessage}"/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.