Hi

I have a class implementing an interface annotated as a web service. In the
method of this class, I handle the request.

Now, I want to use the IP of the client in the logic of the method. So I
wrote an interceptor that gets the IP:

public class IpCxfInterceptor extends AbstractPhaseInterceptor<Message>

{

      @Override

      public void handleMessage(Message message) throws Fault

      {

            HttpServletRequest request =

 

            (HttpServletRequest)
message.get(AbstractHTTPDestination.HTTP_REQUEST);

            String clientAddress = null;

            if (null != request)

            {

                  clientAddress = request.getRemoteAddr();

            }

            System.out.println("IP="

                + clientAddress);

      }

      

      public IpCxfInterceptor()

      {

            super(Phase.RECIEVE);

      }

}

 

The problem is - how can I pass the IP to the method? The method's arguments
are according to the WSDL, I can't change them and add "ip" or something
like that.

 

Thanks

Yair

 

 

Reply via email to