我面临着一种情况,我们无法使用模式来验证传入的请求(基本上模式就在那里,但它接受请求中的任何字符串,wsdl 设计者有自己的理由这样做,以接受来自不同来源和灵活性的请求)。但是,当收到请求时,我会验证请求包装器的子元素是否是我们所期望的(为此使用 XPath)。现在,如果子元素不是预期的,我想抛出Soap Fault
with Client
代码,并且可能包含架构验证失败的错误消息,请求不包含有效元素。
我正在使用 Mule 3.3 并做我的XPath
验证在<choice>
元素,我想抛出异常<otherwise>
block.
- 有没有办法扔
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>
由于您正在使用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>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)