Try this:

MessageContext messageContext =  MessageContext.getCurrentContext();
String ipAddress =
MessageContext.getStrProp(org.apache.axis.Constants.MC_REMOTE_ADDR);  


-----Original Message-----
From: Peter Feng [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 22, 2006 10:58 AM
To: axis-user@ws.apache.org
Subject: Re: Could I get the client IP address in service or Handler class ?

Perhaps you can check the Soap Envelope headers or Set
Soap Headers with this in your client code.

On the client side to set them if they don't exist in
your soap envelope already...
with automatically generated stubs:
ServiceWS port = service.getServiceWS();
                        org.apache.axis.client.Stub s = (Stub)port;
                
s.setHeader("http://my.name.space/headers","clientIP","127.0.0.1";);
                                                
on the server/handler side:
public void invoke(MessageContext msgContext) throws
AxisFault {
        try {
            System.out.println("Starting Server
verificationn");

            Message inMsg =
msgContext.getRequestMessage();
            Message outMsg =
msgContext.getResponseMessage();
                                                
            // verify signed message
                                                SOAPHeader
sh=inMsg.getSOAPHeader();
                                                SOAPHeaderElement she;
                                                System.out.println("get
inMsg soap header");
                                                Iterator
it=sh.examineAllHeaderElements();//"http://my.name.space/headers";);
                                                while(it.hasNext()){
        
she=(SOAPHeaderElement)it.next();
        
System.out.println("examining soap header name
"+she.getNodeName()+" and val:"+she.getValue());
                                                }
                                
Hope this helps.

--- � 軼(CEC) <[EMAIL PROTECTED]> wrote:

> hi all,
> 
> Could I get the client IP address in service class?
> or Handler's invoke()
> method ?
> 
> Any help or web resources would be greatly
> appreciated !
> 
> Regards,
> - sukie
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to