Re: Could I get the client IP address in service or Handler class ?
hi XingShan and Davanum, Thank you very much for your help ! Now I can get the client IP, thanks again ! Regards, - sukie - Original Message - From: "蘇 軼(CEC)" <[EMAIL PROTECTED]> To: Sent: Thursday, June 22, 2006 11:24 AM Subject: Could I get the client IP address in service or Handler class ? > 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] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Could I get the client IP address in service or Handler class ?
http://wiki.apache.org/ws/FrontPage/Axis/ClientIP On 6/22/06, Peter Feng <[EMAIL PROTECTED]> wrote: 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] -- Davanum Srinivas : http://people.apache.org/~dims/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Could I get the client IP address in service or Handler class ?
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]
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]