You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Thomas Pang <th...@db.com> on 2001/10/15 01:17:22 UTC

How do I get the IP info from within a SOAP method

Hi all,
     I'm currently using Axis for a project and I would be grateful if someone could tell me
how to do the following:

If I have a SOAP method loginand it has a signature String login(),how would I capture the IP of the session (i.e. the incoming IP)
from within this method.  I already know that if I have a handler, say authenticate, I have the parameter MessageContext which
will then allow me to obtain the IP address.

-If the two calls are chained together, how can I pass this information (plus other information)
to my SOAP method in a thread safe way?

-Can I assume the two calls are executed under the same thread (maybe I can name the  thread and
then record the information in some store, and then grab the information from within the SOAP method)?


Thanks in advance

Thomas.




--

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.



Re: How do I get the IP info from within a SOAP method

Posted by Glen Daniels <gd...@macromedia.com>.
Hi Thomas!

> If I have a SOAP method loginand it has a signature String login(),how
would I capture the IP of the session (i.e. the incoming IP)
> from within this method.  I already know that if I have a handler, say
authenticate, I have the parameter MessageContext which
> will then allow me to obtain the IP address.

If you have a method on your service class with the first parameter as a
MessageContext, the Axis engine will automatically pass the current
MessageContext to your method.  I.e. if I have this method:

   public String doIt(MessageContext mc, String arg);

Someone can make a soap call to doIt passing a single string param and my
method will get called correctly.

> -If the two calls are chained together, how can I pass this information
(plus other information)
> to my SOAP method in a thread safe way?

Which two calls?  Do you mean the Handler and the service method invocation?
See above if so.

> -Can I assume the two calls are executed under the same thread (maybe I
can name the  thread and
> then record the information in some store, and then grab the information
from within the SOAP method)?

Again, assuming you're still talking about getting context information from
a single SOAP call, the MessageContext argument on your service method is
the way to go.  If you mean storing context between multiple SOAP
invocations, you're talking about sessions, which is another topic.

Hope this helps,
--Glen