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?