简体   繁体   中英

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 ?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM