Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intercept request with a payload that have not been defined in a EndpointMapping [SWS-864] #939

gregturn opened this issue Feb 20, 2014 · 1 comment


Copy link

@gregturn gregturn commented Feb 20, 2014

Thomas Champagne opened SWS-864 and commented

With the current EndpointInterceptor implementation, it is not possible to handle a request with a payload that have not been defined in a EndpointMapping. The handleRequest method of EndpointInterceptor is called after the MessageDispather get an endpoint based on the payload request. If no endpoint is found, the MessageDispatcher throws NoEndpointFoundException (and generate with servlet a 404 error).
So, it's not possible to use the PayloadTransformingInterceptor for changing the namespace or name of a payload element because this QName may not be defined in a EndpointMapping.

For example, with this payload :

@PayloadRoot(localPart = "TestRequest", namespace = "")

and I want to transform request from namespace to, so I define this interceptor :

  <sws:payloadRoot namespaceUri="">
    <bean class="">
      <property name="requestXslt" value="v1tov2.xslt" />

But if I call with this request :

<TestRequest xmlns="" />

the MessageDispather throws a "no endpoint found".

I read the spring-ws code and I found two solution to fix this problem.

The first solution is to add a new method in EndPointInterceptor interface (or add a new interface) without endpoint parameter (EndpointInvocationChain mappedEndpoint) : handleRequest(MessageContext messageContext).
And call it before get the endpoint in MessageDispatcher.

The second solution is to be able to define some @PayloadRoot on a method. But for this, you must create a new annotation to accept some @PayloadRoot. For example, @PayloadRoots. And for example, you could have :

  @PayloadRoot(localPart = "TestRequest", namespace = ""),
  @PayloadRoot(localPart = "TestRequest", namespace = "")
public TestResponse test(TestRequest test);

Affects: 2.1.4

Referenced from: commits 35a8831

Copy link
Member Author

@gregturn gregturn commented Feb 25, 2014

Arjen Poutsma commented

Fixed by introducing a @PayloadRoots annotation. Nice idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants