views:

1238

answers:

2

What is the "canonical" way to access the MessageContext from a PayloadEndpoint?

We are using PayloadEndpoint and AbstractMarshallingPayloadEndpoint which do not expose the MessageContext to their invoke / invokeinternal methods, but will now need to access the HTTP request parameters.

A: 

Easiest way I can think of: create a 'wrapper' endpoint which implements MessageEndpoint. Then you can extract your request parameters and pass them down to your actual endpoint.

You could store the request variables in a ThreadLocal so the original endpoint can access them.

Phill Sacre
That's the method we have been using successfully. The EndpointInterceptor method does not currently work (as of Spring-ws 1.5.4) since the connection is accessed anyway - even if the interceptor sets a response.
hstoerr
A: 

Someone on the Spring forum suggested to use the TransportContext to access the HTTP request parameters. This helps to solve our particular problem, but does not answer the original question how to get the MessageContext.

Another Idea would be to introduce an EndpointInterceptor and use a ThreadLocal. But I was hoping there is a way that feels less like hack.

hstoerr