Salman
Salman

Reputation: 1262

How to get IP address of the calling client to the web-service application built in Jdeveloper 11.1.1.7?

I built a web-service application in Jdeveloper 11.1.1.7 to be used by other clients. Simply the general steps as follow (Server web-service Application is built ---> Deployed on server ---> Used by clients through WSDL file location).

Now I come across a requirement where I need to get the client's IP address and port number.

Questions:

How to get IP address of the calling client to the web-service application built in Jdeveloper?

Common technologies used to built web-service applications is AXIS or CXF. What technology Jdeveloper use to built web service application ?

Upvotes: 0

Views: 2322

Answers (2)

Salman
Salman

Reputation: 1262

here is how I solve the problem based on @Tomaz Solution:

jax ws getting client ip

In Class:

 @Resource WebServiceContext wsContext;

In Web Method:

MessageContext msgx = wsContext.getMessageContext();
HttpServletRequest req = (HttpServletRequest)msgx.get(MessageContext.SERVLET_REQUEST);
String inCommingClientIpAddress=req.getRemoteAddr();

System.out.println("Client IP is: "+inCommingClientIpAddress

Upvotes: 0

Tomasz W
Tomasz W

Reputation: 2283

This solution should work fine for you, it uses only the standard JAX-WS interface https://stackoverflow.com/a/12816220/1643498

I am not sure about the Web Service stack used in JDeveloper/Oracle ADF, this is most likely the WebLogic implementation of JAX-WS.

Upvotes: 1

Related Questions