This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes How to get access to MessageContext in a non-endpoint class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to get access to MessageContext in a non-endpoint class?" Watch "How to get access to MessageContext in a non-endpoint class?" New topic
Author

How to get access to MessageContext in a non-endpoint class?

Eric B.
Greenhorn

Joined: May 31, 2006
Posts: 2
Hi,

I'm looking to access information in my SOAP header from within a non-endpoint class in my JAX-WS WebService. To be specific, I want to access a Locale parameter that the client is sending in the header. I know that I can access the header from within a Handler, or get access to the WebServiceContext in my endpoint class (ie: the one annotated with @WebService), but I need the locale in another class (specifically an aspect). And I am not convinced that the only way to do this should be to extract it in the endpoint class, and pass it as part of the parameter list to any calls.

I realize that if my aspect is wrapping my endpoint, I can access the WebServiceContext from the join point target, but I was hoping I could inject the MessageContext elsewhere.

From what I understand, the MessageContext in a webservice is somewhat analogous to a Request object in a servlet - ie: it can contain metadata for the request that is accessible for the lifetime of the request. However, I have been completely unable to figure out any way to access the MessageContext (via any process other than part of a parameter chain) in any class other than a Handler or the endpoint.

Is this even feasible? Is my concept completely wrong? Should I only be accessing the MessageContext from within the endpoint, and passing everything as parameters-only? Or is there a way to get access to the MessageContext from within a specific class?

Thanks,

Eric
Ayyadapu Sunitha
Greenhorn

Joined: Feb 29, 2012
Posts: 2
Hi Eric,

MessageContext can only be accessed within the Service End Point.

If we want to have access to the mesage context in a spefic non Service end point class, we can pass it as aparameter from the Service end point

thanks,
Sunitha
 
Consider Paul's rocket mass heater.
 
subject: How to get access to MessageContext in a non-endpoint class?
 
Similar Threads
How to identify client calls from server side
how to read config file when web service starts up
javax.xml.ws webserviceprovider how to get POST parameters?
How to implement Stateful webservices?
finding response time for quality of webservices using java in axis2