我面临的情况是我们不能使用模式来验证传入的请求(基本上架构在那里,但它接受请求中的任何字符串,wsdl设计者有自己的理由来接受来自不同来源的请求和灵活性).但是当收到请求时,我验证请求包装器的子元素是我们期望的(使用XPath).现在,如果子元素是不是有什么期望,我想抛出Soap Fault与Client代码,并且可包括架构验证失败,请求不包含有效的元素错误信息.
我正在使用Mule 3.3并XPath在<choice>元素中进行验证,我想在<otherwise>块中抛出异常.
Soap Fault手动投掷骡子流和outInterceptor会解决目的,因为我没有使用schemaValidation属性<cxf:proxyService>.这是我流程的一部分
<http:inbound-endpoint address="${service.address}" exchange-pattern="request-response">
<cxf:proxy-service wsdlLocation="classpath:service.wsdl" namespace="http://company.com/services/service" service="CompanyService" />
</http:inbound-endpoint>
<choice>
<when>.....</when>
<otherwise><!-- Here I want to throw Soap Fault ---></otherwise>
</choice>
<catch-exception-strategy>
<flow-ref name="generateErrorResponse" />
</catch-exception-strategy>
Run Code Online (Sandbox Code Playgroud)
由于您正在使用a,因此cxf:proxy-service您可以完全控制响应.例如,如果在otherwise块中添加以下内容,则可以创建所需的任何SOAP错误:
<expression-component><![CDATA[
message.payload = '<soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
+ '<faultcode>A code</faultcode><faultstring>A string</faultstring>'
+ '</soap:Fault>';
]]></expression-component>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2624 次 |
| 最近记录: |