spring-projects / spring-ws

Spring Web Services
https://spring.io/projects/spring-ws
Apache License 2.0
317 stars 309 forks source link

Endpoint specific Interceptors Not Working properly [SWS-1064] #1130

Open gregturn opened 5 years ago

gregturn commented 5 years ago

Allen Joseph opened SWS-1064 and commented

Hello there,

We need to intercept two different Soap Requests and apply different XSLTs using PayloadTransformingInterceptor. We have tried registering the interceptor for 1 soap request like this 

 

@EnableWs @Configuration

public class ServiceConfig extends WsConfigurerAdapter

{

@Override

public void addInterceptors(List\ interceptors)

{  

PayloadTransformingInterceptor transformInterceptor1 = new PayloadTransformingInterceptor();  

transformInterceptor1.setRequestXslt(new ClassPathResource("Request.xslt"));

transformInterceptor1.setResponseXslt(new ClassPathResource("Response.xslt")); 

interceptors.add(new PayloadRootSmartSoapEndpointInterceptor(transformInterceptor1,ApplicationConstants.NAMESPACE_URI,ApplicationConstants.localPart));         }

...

}

 

However we see that , it is intercepting both the SOAP requests, although we have specified only for one namespace & localPart, while registering the interceptor.

 

We have tried this with SoapActionSmartEndpointInterceptor as well, but still see the same result.

Our namespace and locapart for the two SolveRequests are

Namespace Uri 1

http://testwebservice.com/schemas/webservice/test/messages/authorisation

LocalPart 1

MSG_AUTHORISATION

Namespace Uri 2

http://testwebservice.com/schemas/webservice/test/messages/complete

LocalPart 2

MSG_COMPLETE

 

Would you please check & advise, why is this discrepancy? Is it a known issue?

 

 

 

 

 

 

 

 

 


1 votes, 2 watchers

nicktombeur commented 1 month ago

Apparently, you have to create a bean now for SmartInterceptors and not add them to the list.

@Bean
public PayloadRootSmartSoapEndpointInterceptor myEndpointInterceptor() {
  return new PayloadRootSmartSoapEndpointInterceptor(new MyEndPointInterceptor(), NAMESPACE, LOCAL_PART);
}