Search code examples
web-servicesip-addresslotus-domino

WebService in Lotus Domino in Java getting the IP Address of the Client


We have written a webservice provider in Java in Lotus Domino. Now we would like to obtain the IP Address of the webservice Consument, but unfortunately this is not easy.

My first try was :

 mc = MessageContext.getCurrentContext();
 String remoteAddr = "REMOTE_ADDR?" + mc.getProperty("REMOTE_ADDR");

Second try:

String remoteIP = mc.getStrProp(Constants.MC_REMOTE_ADDR);

Not working as well.

So i have tried to get all properties available in the MessageContext

Iterator x = mc.getPropertyNames();

      while (x.hasNext()) {

        String strX = x.next().toString();

// OutPut of the strX

      }

And the output was:

RPC
transport.url

Well, nothing helpfull.

Has anybody found a working solution?

According to this blog http://www.unimatrix-0.de/index.php?option=com_content&view=article&id=50:messagecontext-im-domino-webservice&catid=35:webservices&Itemid=55 in the old version there were only a few properties, which were distributed from axis.

Thanx a lot for any idea.


Solution

  • WebServiceBase.getAgentSession().getAgentContext().getDocumentContext().getItemValueString("Remote_Addr");

    note: there might be easier way to get AgentContext, but this works. and as long as it compiles..:-)