【发布时间】:2014-04-22 11:27:20
【问题描述】:
我正在使用 Spring-ws 2.1.4.RELEASE 和 Spring 3.2.8.RELEASE。 我正在尝试向我的端点添加一个拦截器,但到目前为止没有运气,即使我认为我的设置非常基本。
在我的 Spring-ws XML 中,我有:
<sws:interceptors>
<bean class="org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor"/>
</sws:interceptors>
<sws:annotation-driven/>
<context:component-scan base-package="package.with.my.endpoints" />
<bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory">
<property name="payloadCaching" value="true"/>
</bean>
在我的 Endpoint 注释 bean 中,我使用 Spring-ws @Action 注释进行 ws 寻址映射:
@Endpoint("MedicineCardIdwsEndpoint")
public class MedicineCardIdws {
@Action("http://someuriandversion#GetMedicineCardIdws")
@ResponsePayload
public String getMedicineCard(@RequestPayload Element payload, SoapMessage soapMessage) {
return "";
}
但是,当我向端点发送请求时,拦截器没有记录任何内容。起初我以为我错误地配置了 log4j。但是,如果我在 org.springframework.ws.server.endpoint.AbstractLoggingInterceptor#handleRequest 的第一行创建断点,则永远不会触发断点。
然后我在 org.springframework.ws.soap.server.SoapMessageDispatcher#headerUnderstood 中放置了一个断点,我可以看到为我的 Endpoint 注册的唯一拦截器是 org.springframework.ws.soap.addressing.server.AddressingEndpointInterceptor由于 Action 注释而被添加。
我认为 XML 配置中的任何全局拦截器最终都会被添加到所有端点的拦截器链中?然而,情况似乎并非如此。不仅仅是日志拦截器,甚至没有添加自定义拦截器。所以我一定是做错了什么。
我在使用 Spring-ws 方面还很陌生——我是否遗漏了配置中的某些内容,或者是否需要添加注释才能为注释扫描端点添加拦截器?
在使用 Spring-ws 的组件扫描和注释时,是否有另一种方法可以将拦截器添加到我的拦截器链中,或者我是否需要在 XML 中配置所有这些以确保我的拦截器被添加到我的端点?
【问题讨论】:
标签: spring web-services spring-ws