Re: Passing info from SOAP Handlers to Web Service methods

From: Sen, Puny <Punyanjan.Sen_at_SOFTWAREAGUSA.COM>
Date: Mon, 21 Oct 2002 12:31:34 -0600


Thanks - this works really well.


-----Original Message-----
From: Arun Gupta [mailto:arun.gupta_at_SUN.COM]
Sent: Friday, October 18, 2002 5:01 PM
Subject: Re: Passing info from SOAP Handlers to Web Service methods

Hi Puny,

In your handleRequest, set the properties as:

context.setProperty("foo", "bar");

For a servlet-based endpoint, you service endpoint implementation has to
implement javax.xml.rpc.server.ServiceLifecycle. Then you can access the
servlet context in the init method as follows:

public void init(Object context) {
   servletEndpointContext = ((ServletEndpointContext)context);
   if (servletEndpointContext == null) {
       System.out.println("In init(): servletEndpointContext is null");

In the service endpoint implementation method, you can access the
properties as:

MessageContext messageContext =
if (messageContext != null) {
    String propVal1 = (String)messageContext.getProperty("foo");

If you want, you can modify this property in your method implementation
and access the modified property in handleResponse of your server-side

Thanks for your interest in JAX-RPC.


"Sen, Puny" wrote:
> Hi,
> Is it possible to pass information like a variable or object from a server
> side SOAP Handler to the Web Service methods?
> Thanks,
> Puny

There is only one me, I must live myself!
There is only one today, I must live itself!