Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Trust God, but always tether your camel... to this tiny ad.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic