如果 spring 集成中的 soap 请求端点错误或无效,如何提供自定义 soap 故障消息

How to provide custom soap fault message if endpoint is wrong or invalid in soap request in spring integration

我正在 spring 集成 soap Web 服务模块来满足我的项目要求。在我的项目中,如果 soap 请求找不到端点,则需要发送像 "Invalid endpoint" 这样的 soap 错误消息,例如,如果访问我的服务的端点是 http://www.mycomp.com/mychannel in request but user sends in request http://www.mycomp.com/myproject,我想发送响应为"invalid endpoint" soap fault.How 我可以在 spring 集成中实现这个吗? 请在下面找到 ws-conf.xml

<context:component-scan base-package="com.mycomp.mychannel" />
<context:spring-configured/>
<context:annotation-config/>

<import resource="classpath:/WEB-INF/soap/config/g-config.xml" />
<!-- this is used for the endpoint mapping for soap request -->
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping" />

提前致谢。

您的问题无效或不完整。或者我就是不理解你。

实际上 MessageDispatcherServlet (Spring WS) 只是将请求委托给 SoapMessageDispatcher,如果没有提供 path 在请求中。

并且该异常将被视为带有 faultMessage 的 SOAPFault,如 No endpoint can be found for request ...

所以,请更具体一点。看起来 Spring WS 已经具备所有必需的功能。