Getting request IP address

2009-12-10 Thread Murphey McCloy
Hello.

I am using axis2c 1.6 and I am trying to get the ip address (or hostname) of 
the host that generate the web service requests.  I was attempting to use 
axis2_msg_ctx_get_from and then axis2_endpoint_ref_get_address to do this.  
Unfortunately this is giving me the address of the server, not the client.

Am I mis-using this API call? Is there a better/different way to get this 
information?

This is how my code looks:

fromRef = axis2_msg_ctx_get_from(pMsgCtx, pEnv);
if (fromRef) {
from = (axis2_char_t*)axis2_endpoint_ref_get_address(fromRef, pEnv);
}

Any help is greatly appreciated.

Thanks,

Murphey


Re: Getting request IP address

2009-12-10 Thread Nabeel Naseem Ahsan
Hello Murphey,

 I got the address using axis2_msg_ctx_get_property. For that I needed
a pointer to axis2_msg_ctx_t, which i updated in my
axis2_skel_xx.h file

Sample: axis2_skel_KeyExchange.h

adb_DoKeyExchangeResponse_t*
axis2_skel_KeyExchange_DoKeyExchange (const axutil_env_t *env  ,
  adb_DoKeyExchange_t*
doKeyExchange,axis2_msg_ctx_t *msg_ctx);

Similarly in my axis2_skel_KeyExchange.c file

updated the call,

adb_DoKeyExchangeResponse_t* axis2_skel_KeyExchange_DoKeyExchange
(const axutil_env_t *env,
  adb_DoKeyExchange_t* doKeyExchange,axis2_msg_ctx_t *msg_ctx)
{

and with the following code got the 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);

Regards,
Nabeel Ahsan


On Fri, Dec 11, 2009 at 1:24 AM, Murphey McCloy mmcc...@webroot.com wrote:
 Hello.

 I am using axis2c 1.6 and I am trying to get the ip address (or hostname) of 
 the host that generate the web service requests.  I was attempting to use 
 axis2_msg_ctx_get_from and then axis2_endpoint_ref_get_address to do this.  
 Unfortunately this is giving me the address of the server, not the client.

 Am I mis-using this API call? Is there a better/different way to get this 
 information?

 This is how my code looks:

 fromRef = axis2_msg_ctx_get_from(pMsgCtx, pEnv);
 if (fromRef) {
    from = (axis2_char_t*)axis2_endpoint_ref_get_address(fromRef, pEnv);
 }

 Any help is greatly appreciated.

 Thanks,

 Murphey