Return-Path: Delivered-To: apmail-ws-axis-c-user-archive@www.apache.org Received: (qmail 8722 invoked from network); 10 Jul 2009 11:48:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Jul 2009 11:48:41 -0000 Received: (qmail 97697 invoked by uid 500); 10 Jul 2009 11:48:51 -0000 Delivered-To: apmail-ws-axis-c-user-archive@ws.apache.org Received: (qmail 97683 invoked by uid 500); 10 Jul 2009 11:48:51 -0000 Mailing-List: contact axis-c-user-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C User List" Reply-To: "Apache AXIS C User List" Delivered-To: mailing list axis-c-user@ws.apache.org Received: (qmail 97674 invoked by uid 99); 10 Jul 2009 11:48:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jul 2009 11:48:51 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of scarleton@gmail.com designates 74.125.92.145 as permitted sender) Received: from [74.125.92.145] (HELO qw-out-1920.google.com) (74.125.92.145) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jul 2009 11:48:43 +0000 Received: by qw-out-1920.google.com with SMTP id 4so554862qwk.28 for ; Fri, 10 Jul 2009 04:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=YmS9T8ahb1yqzdvIEbZ2u6vlRSaDJ1UG/m9kq/pceog=; b=DxVvAP0+Dte7SXODW+wfC6v08cBi5AmlTxJzlVC5PYs/AhluvSuphkUVGnanWYThuI TYFlIrjsp3jOp6g4VDOhCgkBjJOcxGYTASnCNCq+e0nkR6GfndtFj9Do2EXtoAc5vpDj ixLdRt8b2mNi+i5pnnJSBaiEiUHmfkB8BWDZ8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Z5U+WMj0OBVf+TGlpuyq7LZHEihoAThH5D5/ip6rhLn5/qN1jV/0fpK6kobUoYrXta FMGotctl1fooLICd/evJyiWejp6yb27/+1IiPT7Le7pUVyjpbcMOEc+px53iFjIHgtST u1l4+H3pcCkyF6hFvCUnNtbNQIvdUcZWnxnVs= MIME-Version: 1.0 Received: by 10.224.37.65 with SMTP id w1mr1178624qad.295.1247226502566; Fri, 10 Jul 2009 04:48:22 -0700 (PDT) In-Reply-To: <200907101410.50327.shristov@gcn.bg> References: <200907091840.46608.shristov@gcn.bg> <200907101410.50327.shristov@gcn.bg> Date: Fri, 10 Jul 2009 07:48:22 -0400 Message-ID: <8d38ca0a0907100448r3da0f65pb0d4d6e5bb459f43@mail.gmail.com> Subject: Re: Obtaining consumer address from Axis2/C service - SOLVED From: Sam Carleton To: Apache AXIS C User List Content-Type: multipart/alternative; boundary=0015175cdc60a3d61e046e588c95 X-Virus-Checked: Checked by ClamAV on apache.org --0015175cdc60a3d61e046e588c95 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Thank you for posting the answer, this could be very useful! On Fri, Jul 10, 2009 at 7:10 AM, Stefan Hristov wrote: > Well, looking at the source usually helps :) > > There is a property in msg_ctx called AXIS2_SVR_PEER_IP_ADDR which contains > the remote peer IP address. > So basically this is how one could get the web-service consumer IP address: > > axutil_property_t *peer = axis2_msg_ctx_get_property > (msg_ctx, env, AXIS2_SVR_PEER_IP_ADDR); > char *remote_ip = (char *) axutil_property_get_value (peer, > env); > AXIS2_LOG_INFO (env->log, "Got a call from %s", remote_ip); > > On Thursday 09 July 2009 18:40:46 Stefan Hristov wrote: > > Hi all, > > > > I am writing a web-service using Axis2/C v1.6.0. The service is deployed > with Apache2 mod-axis2.so. > > > > I need to get the sender IP address (or anything which can be used to > identify the consumer) when my service is called (meaning, in > axis2_svc_skel_XXX_invoke function). > > > > I have searched through the API documentation using axis2_msg_ctx_t as a > reference (the startup data I have in invoke function), but unfortunately > the functions I've found return my own address (the full URL, actually), not > senders. I mean axis2_msg_ctx_get_from and axis2_options_get_from, both > yielding axis2_endpoint_ref_t type. There are few similar other functions, > but they all are returning NULL. > > > > Any suggestions or pointers, please? :) > > > --0015175cdc60a3d61e046e588c95 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you for posting the answer, this could be very useful!

On Fri, Jul 10, 2009 at 7:10 AM, Stefan Hristov <shristov@gcn.bg> wrote:
Well, looking at = the source usually helps :)

There is a property in msg_ctx called AXIS2_SVR_PEER_IP_ADDR which contains= the remote peer IP address.
So basically this is how one could get the web-service consumer IP address:=

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0axutil_property_t *= peer =3D axis2_msg_ctx_get_property (msg_ctx, env, AXIS2_SVR_PEER_IP_ADDR);=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char *remote_ip =3D= (char *) axutil_property_get_value (peer, env);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0AXIS2_LOG_INFO (env= ->log, "Got a call from %s", remote_ip);

On Thursday 09 July 2009 18:40:46 Stefan Hristov wrote:
> Hi all,
>
> I am writing a web-service using Axis2/C v1.6.0. The service is deploy= ed with Apache2 mod-axis2.so.
>
> I need to get the sender IP address (or anything which can be used to = identify the consumer) when my service is called (meaning, in axis2_svc_ske= l_XXX_invoke function).
>
> I have searched through the API documentation using axis2_msg_ctx_t as= a reference (the startup data I have in invoke function), but unfortunatel= y the functions I've found return my own address (the full URL, actuall= y), not senders. I mean axis2_msg_ctx_get_from and axis2_options_get_from, = both yielding axis2_endpoint_ref_t type. There are few similar other functi= ons, but they all are returning NULL.
>
> Any suggestions or pointers, please? :)
>

--0015175cdc60a3d61e046e588c95--