Spring WS and PayloadRootAnnotationMethodEndpointMapping

I have two endpoints using annotations. I want to apply different interceptors to each of them. (one of them is a safe interceptor and the other is unprotected). Is there a way to do this using PayloadRootAnnotationMethodEndpointMapping

? Anyone have an idea?

According to the applicationContext-ws.xml of the airline example that ships with Spring:

Displays the mappings of endpoints from a query to an endpoint. Because we only need a security intercept for GetFrequentFlyerMileageEndpoint

, we define two mappings: one with a securityInterceptor and a generic one without it.

So the only way to do this is to have two different mappings: org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping

and org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping

for the safe ones?

+2


source to share


2 answers


When you pass an interceptor set to EndpointMapping

then those interceptors will apply to all endpoints mapped by this EndpointMapping

. So if you want some endpoints to receive a different set of interceptors for other endpoints, then yes, you need two different EndpointMapping

beans, one with a secured interceptor and a mapping to secure endpoints, and the other without interceptors and mappings to unsecured endpoints.



Which implementations EndpointMapping

you use depend on the application and what types of endpoints it uses.

+1


source


You can also use the sws: interceptors element in your application context to specify specific interceptors with specific endpoints, filtered by their soapAction or payloadRoot attributes.

From: http://static.springsource.org/spring-ws/site/reference/html/server.html#server-endpoint-interceptor



<sws:interceptors>
  <bean class="samples.MyGlobalInterceptor"/>
  <sws:payloadRoot namespaceUri="http://www.example.com">
    <bean class="samples.MyPayloadRootInterceptor"/>
  </sws:payloadRoot>
  <sws:soapAction value="http://www.example.com/SoapAction">
    <bean class="samples.MySoapActionInterceptor1"/>
    <ref bean="mySoapActionInterceptor2"/>
  </sws:soapAction>
</sws:interceptors>

<bean id="mySoapActionInterceptor2" class="samples.MySoapActionInterceptor2"/>

      

+1


source







All Articles