【发布时间】:2014-05-21 06:51:38
【问题描述】:
我有以下设置连接如下:
1) 响应和请求通道
2) 用于 ws 对系统值对象的响应/请求的转换器
3) WS 请求/响应通道
4) 出站网关
<!-- ~~~~~~~~~~~~~~~~~ -->
<!-- integration layer -->
<!-- ~~~~~~~~~~~~~~~~~ -->
<int:channel id="getStatusRequestChannel"/>
<int:channel id="getStatusResponseChannel"/>
<int:channel id="getStatusWSRequestChannel"/>
<int:channel id="getStatusWSResponseChannel"/>
<!-- ~~~~~~~~~~~~~~~~~~ -->
<!-- gateway definition -->
<!-- ~~~~~~~~~~~~~~~~~~ -->
<int:gateway id="mnpGateway" service-interface="com.iquest.play.integration.mnp.MNPGateway">
<int:method name="getMNPStatus" request-channel="getStatusRequestChannel" reply-channel="getStatusResponseChannel"/>
</int:gateway>
<!-- ~~~~~~~~~~~~~~ -->
<!-- channel chains -->
<!-- ~~~~~~~~~~~~~~ -->
<int:chain input-channel="getStatusRequestChannel" output-channel="getStatusWSRequestChannel">
<int:transformer ref="getStatusTransformer" method="transformMNPStatusRequest"/>
</int:chain>
<int:chain input-channel="getStatusWSResponseChannel" output-channel="getStatusResponseChannel">
<int:transformer ref="getStatusTransformer" method="transformMNPStatusResponse"/>
</int:chain>
<!-- ~~~~~~~~~~~~~~~~ -->
<!-- outbound gateway -->
<!-- ~~~~~~~~~~~~~~~~ -->
<int-ws:outbound-gateway id="getStatusOutboundGW"
request-channel="getStatusWSRequestChannel"
reply-channel="getStatusWSResponseChannel"
marshaller="marshaller"
unmarshaller="marshaller"
destination-provider="mnpUriProvider"/>
这是 WSDL:
<wsdl:operation name="getCaseInfo">
<wsdl:documentation>Message</wsdl:documentation>
<wsdl:input message="tns:GetCaseInfoRequest">
</wsdl:input>
<wsdl:output message="tns:GetCaseInfoResponse">
</wsdl:output>
<wsdl:fault message="tns:GetCaseInfoError" name="getCaseInfoError">
</wsdl:fault>
</wsdl:operation>
如何捕捉肥皂故障?
编辑后:
我尝试扩展 SoapFaultMessageResolver 并覆盖该方法 public void resolveFault(WebServiceMessage message) throws IOException
从那里我试图抛出一个自定义的 IntegrationException(扩展 IOException),我将在调用网关接口的方法中捕获它。这是调用方法:
try {
gateway.MethodA();
} catch (Exception e) {
/// I was trying to catch IntegrationException
}
问题是捕获的异常类型为WebServiceIOException,其根本原因为IntegrationException,它会触发一个巨大的错误日志。所以我觉得这种做法是不对的。
【问题讨论】:
标签: java spring web-services soap wsdl