You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by "Sinha, Madhukar [IT]" <ma...@citigroup.com> on 2002/08/29 21:34:38 UTC

RE: Accessing HTTP Request object(/headers) within Webservice i mplemention class.

Scott,

Thats so good , Thanks a million for helping me with that. 

I had looked  into the source code an noticed the constants class. Thanks
madhukar

-----Original Message-----
From: Scott Nichol [mailto:snicholnews@scottnichol.com]
Sent: Thursday, August 29, 2002 3:29 PM
To: soap-dev@xml.apache.org; soap-user@xml.apache.org
Subject: Re: Accessing HTTP Request object(/headers) within Webservice
implemention class.


This method that has existed for a release or two of the code.  You change
your service methods so that any method that needs access to this
information has an initial parameter of type SOAPContext.  For example, if
your method was

    public String echo(String s)

it is now

    public String echo(SOAPContext ctx, String s)

The SOAP client still behaves as if the method had the original signature,
i.e. it passes a single parameter of type String.  The Apache SOAP server
software will not find a method with such a signature, so it will look for
one with the second signature above.

So, now you have a SOAPContext.  You get things of interest from its
property bag as follows

          req = reqCtx.setProperty(Constants.BAG_HTTPSERVLETREQUEST);
          res = reqCtx.setProperty(Constants.BAG_HTTPSERVLETRESPONSE);

You can see in Constants.java that the following information is available

  public static String BAG_HTTPSERVLET = "HttpServlet" ;
  public static String BAG_HTTPSESSION = "HttpSession" ;
  public static String BAG_HTTPSERVLETREQUEST = "HttpServletRequest" ;
  public static String BAG_HTTPSERVLETRESPONSE = "HttpServletResponse" ;
  public static String BAG_DEPLOYMENTDESCRIPTOR = "DeploymentDescriptor" ;

where I believe the names tell it all.

Scott Nichol
----- Original Message -----
From: "Sinha, Madhukar [IT]" <ma...@citigroup.com>
To: <so...@xml.apache.org>; <so...@xml.apache.org>
Sent: Thursday, August 29, 2002 12:57 PM
Subject: Accessing HTTP Request object(/headers) within Webservice
implemention class.




Hi

 This may be a very trivial question, but i will appriciate if someone could
give pointers or answers.

what is the best way to access HTTP request object from webservice
implementation class. I need to access the HTTP header info , like Cookie
and REMOTE_USER?

Please let me know.

thanks

-

--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>




--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>