You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Javier Gonzalez <ja...@gmail.com> on 2005/08/11 23:23:49 UTC

Get IP address of axis webservice clients?

Hi,

I have a document webservice made with axis, and I have this problem:
One of the clients of said service isn't very "reliable", they are
supposed to provide a certain ID inside the soap message but they
can't really counted on to provide it. I would like to have the IP
address of the client as a backup measure if/when they do not provide
the required ID.

Is that posible using axis?

-- 
Javier Gonzalez Nicolini

Re: Get IP address of axis webservice clients?

Posted by csj <jo...@clarkson.edu>.
See: http://wiki.apache.org/ws/FrontPage/Axis/ClientIP

..Chris

On Thu, 11 Aug 2005, Javier Gonzalez wrote:

> Thanks! Yes, it revolves around getting access to the
> HttpServletRequest object. Finally did it like this:
>
> String ipaddy =
> ((HttpServletRequest)MessageContext.getCurrentContext().getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST)).getRemoteAddr();
>
> On 8/11/05, Linus Kamb <li...@iris.washington.edu> wrote:
> > Don't know if this is standard or even works in all cases (like when using proxy, or
> > whatnot,) but I do:
> >
> > MessageContext ctxt = MessageContext.getCurrentContext();
> > logger.debug("ctxt: " + ctxt );
> > logger.debug( "transport:" + ctxt.getTransportName());
> > javax.servlet.ServletRequest request = (javax.servlet.ServletRequest)
> >                 ctxt.getProperty( "transport.http.servletRequest" );
> > logger.debug( "caller: " + request.getRemoteAddr() +
> >                "[" + request.getRemoteHost() + "]" );
> >
> > This is from servlet stuff, I think.
> >
> >
> > Javier Gonzalez wrote:
> > > Hi,
> > >
> > > I have a document webservice made with axis, and I have this problem:
> > > One of the clients of said service isn't very "reliable", they are
> > > supposed to provide a certain ID inside the soap message but they
> > > can't really counted on to provide it. I would like to have the IP
> > > address of the client as a backup measure if/when they do not provide
> > > the required ID.
> > >
> > > Is that posible using axis?
> > >
> >
>
>
> --
> Javier Gonzalez Nicolini
>

Re: Get IP address of axis webservice clients?

Posted by Javier Gonzalez <ja...@gmail.com>.
Thanks! Yes, it revolves around getting access to the
HttpServletRequest object. Finally did it like this:

String ipaddy =
((HttpServletRequest)MessageContext.getCurrentContext().getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST)).getRemoteAddr();

On 8/11/05, Linus Kamb <li...@iris.washington.edu> wrote:
> Don't know if this is standard or even works in all cases (like when using proxy, or
> whatnot,) but I do:
> 
> MessageContext ctxt = MessageContext.getCurrentContext();
> logger.debug("ctxt: " + ctxt );
> logger.debug( "transport:" + ctxt.getTransportName());
> javax.servlet.ServletRequest request = (javax.servlet.ServletRequest)
>                 ctxt.getProperty( "transport.http.servletRequest" );
> logger.debug( "caller: " + request.getRemoteAddr() +
>                "[" + request.getRemoteHost() + "]" );
> 
> This is from servlet stuff, I think.
> 
> 
> Javier Gonzalez wrote:
> > Hi,
> >
> > I have a document webservice made with axis, and I have this problem:
> > One of the clients of said service isn't very "reliable", they are
> > supposed to provide a certain ID inside the soap message but they
> > can't really counted on to provide it. I would like to have the IP
> > address of the client as a backup measure if/when they do not provide
> > the required ID.
> >
> > Is that posible using axis?
> >
> 


-- 
Javier Gonzalez Nicolini

Re: Get IP address of axis webservice clients?

Posted by Linus Kamb <li...@iris.washington.edu>.
Don't know if this is standard or even works in all cases (like when using proxy, or 
whatnot,) but I do:

MessageContext ctxt = MessageContext.getCurrentContext();
logger.debug("ctxt: " + ctxt );
logger.debug( "transport:" + ctxt.getTransportName());
javax.servlet.ServletRequest request = (javax.servlet.ServletRequest)
                ctxt.getProperty( "transport.http.servletRequest" );
logger.debug( "caller: " + request.getRemoteAddr() +
               "[" + request.getRemoteHost() + "]" );

This is from servlet stuff, I think.


Javier Gonzalez wrote:
> Hi,
> 
> I have a document webservice made with axis, and I have this problem:
> One of the clients of said service isn't very "reliable", they are
> supposed to provide a certain ID inside the soap message but they
> can't really counted on to provide it. I would like to have the IP
> address of the client as a backup measure if/when they do not provide
> the required ID.
> 
> Is that posible using axis?
>