Return-Path: X-Original-To: apmail-axis-java-user-archive@www.apache.org Delivered-To: apmail-axis-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C8DC042EC for ; Fri, 1 Jul 2011 18:04:40 +0000 (UTC) Received: (qmail 76754 invoked by uid 500); 1 Jul 2011 18:04:39 -0000 Delivered-To: apmail-axis-java-user-archive@axis.apache.org Received: (qmail 76516 invoked by uid 500); 1 Jul 2011 18:04:38 -0000 Mailing-List: contact java-user-help@axis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@axis.apache.org Delivered-To: mailing list java-user@axis.apache.org Received: (qmail 76508 invoked by uid 99); 1 Jul 2011 18:04:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2011 18:04:38 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of hedouxt@hotmail.com designates 65.54.51.86 as permitted sender) Received: from [65.54.51.86] (HELO snt0-omc3-s49.snt0.hotmail.com) (65.54.51.86) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2011 18:04:30 +0000 Received: from SNT118-W9 ([65.55.90.136]) by snt0-omc3-s49.snt0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 1 Jul 2011 11:04:09 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_a2cbc780-94eb-4cab-8595-0759ec038fd5_" X-Originating-IP: [62.201.142.21] From: Tony HEDOUX To: Subject: RE: Identify IP address of the source request Date: Fri, 1 Jul 2011 20:04:09 +0200 Importance: Normal In-Reply-To: <2AAC8B004D31D043A4309D2FE18F475A01AD3207D2@exlnmb07.eur.nsroot.net> References: <2AAC8B004D31D043A4309D2FE18F475A01AD29B615@exlnmb07.eur.nsroot.net>,,<2AAC8B004D31D043A4309D2FE18F475A01AD29B638@exlnmb07.eur.nsroot.net>,,<2AAC8B004D31D043A4309D2FE18F475A01AD3207D2@exlnmb07.eur.nsroot.net> MIME-Version: 1.0 X-OriginalArrivalTime: 01 Jul 2011 18:04:09.0745 (UTC) FILETIME=[46A4E010:01CC3819] X-Virus-Checked: Checked by ClamAV on apache.org --_a2cbc780-94eb-4cab-8595-0759ec038fd5_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi=2C You should try the same syntax but in your calling method (not in the init(= ) ). package myWebService=3B import org.apache.axis2.context.MessageContext=3B public class MyService { public String giveYourIp(){ MessageContext msgCtx =3D MessageContext.getCurrentMessageContext()=3B return (String)msgCtx.getProperty(MessageContext.REMOTE_ADDR)=3B=20 } } Tony. From: geethamadhurima.matta@citi.com To: java-user@axis.apache.org Date: Fri=2C 1 Jul 2011 17:45:26 +0100 Subject: RE: Identify IP address of the source request Nadir=2C =20 How to get msgContext obj. I am=20 using: MessageContext msgCtx =3D =20 MessageContext.getCurrentMessageContext()=3B =20 But msgCtx is null. From: Nadir Amra [mailto:amra@us.ibm.com]=20 Sent: 30 June 2011 21:59 To:=20 java-user@axis.apache.org Cc:=20 'java-user@axis.apache.org' Subject: RE: Identify IP address of the=20 source request How about trying something like:=20 (String)msgContext.getProperty(MessageContext.REMOTE_ADDR)=3B=20 Nadir Amra Integrated Web Services for=20 IBM i Operating System Internet: amra@us.ibm.com=20 "Matta=2C Geethamadhurima " wrote on=20 06/30/2011 03:52:58 PM: > From: "Matta=2C Geethamadhurima "=20 =20 > To:=20 "'java-user@axis.apache.org'" =20 > Date: 06/30/2011 03:53 PM=20 > Subject: RE: Identify IP address of the source request=20 >=20 > Deepal=2C >=20 > Following is the=20 code: > --------------------------- > public void=20 init(ServiceContext serviceContext) { > =20 System.out.println("Initializing the service=20 context")=3B > =20 MessageContext msgCtx =3D=20 >=20 MessageContext.getCurrentMessageContext()=3B > =20 if (msgCtx !=3D null) > =20 { > =20 String remoteAddress=20 =3D(String) > msgCtx.getProperty("REMOTE_ADDR")=3B > =20 =20 System.out.println("remoteAddress - " +=20 > remoteAddress)=3B > =20 } > =20 } > --------------------------- >=20 > msgCtx is coming=20 as null. >=20 >=20 >=20 > Regards=2C > Geeta=20 Madhurima > Desk: (212) 723 2505 > -----Original=20 Message----- > From: Deepal Jayasinghe [mailto:deepalk@gmail.com] > Sent:=20 30 June 2011 20:41 > To: java-user@axis.apache.org > Subject: Re:=20 Identify IP address of the source request >=20 > You can get the=20 remote IP address of the client corresponding to the > current message as=20 follows=3B String remoteAddress =3D >=20 String)msgCtx.getProperty("REMOTE_ADDR"): >=20 > Deepal >=20 > On Thu=2C Jun 30=2C 2011 at 3:34 PM=2C Matta=2C Geethamadhurima=20 >=20 wrote: > > Hi=2C >=20 > > > I am using Axis2 1.5.1. > > > > We need to=20 authenticate if the request coming to Axis2 server is=20 > from a valid=20 source. > > Can we identify using the ip address of the source. >=20 > Is there any way to get the ip address of the source from the=20 request? > > > > Regards=2C > > Geeta Madhurima >=20 > Desk: (212) 723 2505 > > > >=20 --------------------------------------------------------------------- >=20 > To unsubscribe=2C e-mail: java-user-unsubscribe@axis.apache.org > >=20 For additional commands=2C e-mail: java-user-help@axis.apache.org >=20 > > > >=20 >=20 >=20 > -- > http://blogs.deepal.org >=20 >=20 --------------------------------------------------------------------- > To=20 unsubscribe=2C e-mail: java-user-unsubscribe@axis.apache.org > For=20 additional commands=2C e-mail: java-user-help@axis.apache.org >=20 >=20 >=20 --------------------------------------------------------------------- > To=20 unsubscribe=2C e-mail: java-user-unsubscribe@axis.apache.org > For=20 additional commands=2C e-mail: java-user-help@axis.apache.org >=20 = --_a2cbc780-94eb-4cab-8595-0759ec038fd5_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi=2C

You should try the same syntax but in your calling method (not= in the init() ).


package myWebService=3B

import org.apac= he.axis2.context.MessageContext=3B

public class MyService {
publi= c String giveYourIp(){
 =3B =3B =3B MessageContext msgCtx = =3D =3B MessageContext.getCurrentMessageContext()=3B
 =3B = =3B =3B return (String)msgCtx.getProperty(MessageContext.REMOTE_ADDR)= =3B
}
}


Tony.


From: g= eethamadhurima.matta@citi.com
To: java-user@axis.apache.org
Date: Fri= =2C 1 Jul 2011 17:45:26 +0100
Subject: RE: Identify IP address of the so= urce request

Nadir=2C
 =3B
How to get msgContext obj.
I am=20 using:
MessageContext msgCtx =3D =3B=20 MessageContext.getCurrentMessageContext()=3B
 =3B
But msgCtx is null.

From: Nadir Amra [mailto:amra@us.ib= m.com]=20
Sent: 30 June 2011 21:59
To:=20 java-user@axis.apache.org
Cc:=20 'java-user@axis.apache.org'
Subject: RE: Identify IP address of t= he=20 source request

How about trying something = like:=20

(String)msgContext.getPropert= y(MessageContext.REMOTE_ADDR)=3B=20

Nadir Amra
Integrated Web S= ervices for=20 IBM i Operating System
Internet: amra@us.ibm.com


"Matta=2C Geethamadhurima " <=3Bgeethamadhurima.matta@citi.c= om>=3B wrote on=20 06/30/2011 03:52:58 PM:

>=3B From: "Matta=2C Geethamadhurima "=20 <=3Bgeethamadhurima.matta@citi.com>=3B

>=3B To:=20 "'java-user@axis.apache.org'" <=3Bjava-user@axis.apache.org>=3B<= /tt>=20
>=3B Date: 06/30/2011 03:53 PM
<= tt>>=3B Subject: RE: Identify IP address of the source r= equest
=20
>=3B
>=3B Deepal=2C
>=3B
>=3B F= ollowing is the=20 code:
>=3B ---------------------------
>=3B public void=20 init(ServiceContext serviceContext) {
>=3B  =3B  =3B  =3B =  =3B  =3B=20  =3B  =3B  =3B System.out.println("Initializing the service=20 context")=3B
>=3B  =3B  =3B  =3B  =3B  =3B  = =3B  =3B  =3B=20 MessageContext msgCtx =3D
>=3B=20 MessageContext.getCurrentMessageContext()=3B
>=3B  =3B  =3B &n= bsp=3B  =3B=20  =3B  =3B  =3B  =3B if (msgCtx !=3D null)
>=3B  = =3B  =3B  =3B=20  =3B  =3B  =3B  =3B  =3B {
>=3B  =3B  =3B =  =3B  =3B  =3B=20  =3B  =3B  =3B  =3B  =3B  =3B  =3B String remot= eAddress=20 =3D(String)
>=3B msgCtx.getProperty("REMOTE_ADDR")=3B
>=3B  = =3B  =3B=20  =3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B &nb= sp=3B  =3B=20 System.out.println("remoteAddress - " +
>=3B remoteAddress)=3B
>= =3B  =3B=20  =3B  =3B  =3B  =3B  =3B  =3B  =3B }
>=3B =  =3B  =3B  =3B=20  =3B }
>=3B ---------------------------
>=3B
>=3B msgCt= x is coming=20 as null.
>=3B
>=3B
>=3B
>=3B Regards=2C
>=3B Ge= eta=20 Madhurima
>=3B Desk: (212) 723 2505
>=3B -----Original=20 Message-----
>=3B From: Deepal Jayasinghe [
mailto:deepalk@gmail.com<= /tt>]
>=3B Sent:=20 30 June 2011 20:41
>=3B To: java-user@axis.apache.org
>=3B Subjec= t: Re:=20 Identify IP address of the source request
>=3B
>=3B You can get = the=20 remote IP address of the client corresponding to the
>=3B current mess= age as=20 follows=3B String remoteAddress =3D
>=3B=20 String)msgCtx.getProperty("REMOTE_ADDR"):
>=3B
>=3B Deepal
&g= t=3B=20
>=3B On Thu=2C Jun 30=2C 2011 at 3:34 PM=2C Matta=2C Geethamadhurima =
>=3B=20 <=3Bgeethamadhurima.matta@citi.com>=3B wrote:
>=3B >=3B Hi=2C>=3B=20 >=3B
>=3B >=3B I am using Axis2 1.5.1.
>=3B >=3B
>=3B = >=3B We need to=20 authenticate if the request coming to Axis2 server is
>=3B from a val= id=20 source.
>=3B >=3B Can we identify using the ip address of the source= .
>=3B=20 >=3B Is there any way to get the ip address of the source from the=20 request?
>=3B >=3B
>=3B >=3B Regards=2C
>=3B >=3B Geet= a Madhurima
>=3B=20 >=3B Desk: (212) 723 2505
>=3B >=3B
>=3B >=3B=20 ---------------------------------------------------------------------
&g= t=3B=20 >=3B To unsubscribe=2C e-mail: java-user-unsubscribe@axis.apache.org
&= gt=3B >=3B=20 For additional commands=2C e-mail: java-user-help@axis.apache.org
>=3B= =20 >=3B
>=3B >=3B
>=3B
>=3B
>=3B
>=3B --
&g= t=3B
http://blogs.deepal.org

>=3B
>=3B=20 ---------------------------------------------------------------------
&g= t=3B To=20 unsubscribe=2C e-mail: java-user-unsubscribe@axis.apache.org
>=3B For= =20 additional commands=2C e-mail: java-user-help@axis.apache.org
>=3B >=3B=20
>=3B=20 ---------------------------------------------------------------------
&g= t=3B To=20 unsubscribe=2C e-mail: java-user-unsubscribe@axis.apache.org
>=3B For= =20 additional commands=2C e-mail: java-user-help@axis.apache.org
>=3B=20
= --_a2cbc780-94eb-4cab-8595-0759ec038fd5_--