You can get access to the MessageContext in your threads IF you put it there yourself instead of depending on the static method MessageContext.getCurrentContext(). Having invoked that method where it works (the thread handling the web service request), you can place the result in a thread local of other threads.

That is, if your thread lives for the processing of a single request, you can copy the message context reference to it when you create the thread. Otherwise you copy it to the thread each time it starts processing a request.
Jeff

Juha Kononen wrote:

Thanks for advise!

Too bad that it's not possible to get an access to MessageContext in
user's own threads.
Does this mean that the session mechanism can be used only partially in
axis (because there is no
way to get HttpSession in threads)? I had an idea to use HttpSession as
a global variable in each session where to
store session-specific information (data sent by a client) for each
client. This global
session-specific storage would help me to get data directly instead of
passing it
to objects and threads via many function parameters (in contrast to
HttpSession I use ServletContext as a global variable
for storing a reference to a database pool). Of course, I could get the
data sent by a client via a static class variable
in my DSServiceSOAPBindingImpl class. But unfortunately class variables
are shared with all sessions, so that will not work if
I want my class variables to be session-spefic. So is there any way I
can use a global, session-specific variable anywhere in
my server-side code (including those threads)? Java doesn't have global
variables, but don't we still need them? :)

Juha


Reply via email to