Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!