views:

343

answers:

1

I'm using XFire as the Web Services provider for Spring Remoting. I'm using an AbstractHandler to authenticate the SOAP request. The idea is to identify the request by the originating server's domain and an API key (a-la Google Maps). The only problem is that I can't seem to find a way to fetch the ServletRequest object from within the invoke() method, which only accepts a MessageContext object.

The only idea I can think of is using a Filter and storing the request object inside a ThreadLocal variable, but I'd really prefer to avoid this solution.

Any ideas?

Cheers

Shai

+1  A: 

I haven't tested this but I have the source for XFire handy so I dug into the classes to see if this would be easy. From within the call to invoke you should be able to get the ServletRequest with the following code:

ServletRequest request = (ServletRequest) context.getProperty(org.codehaus.xfire.transport.http.XFireServletController.HTTP_SERVLET_REQUEST);
laz
Thanks! Should've thought of downloading the source code myself :)
Electric Monk