import javax
import javax
import javax
import javax
@Resource
private WebServiceContext wsContext;
private String getClientInfo(){
MessageContext mc = wsContext
HttpServletRequest request = (HttpServletRequest)(mc
String remortAddress = request
return (remortAddress);
}
/**
* 獲取客戶端IP地址
* 適用於axis發布的webservice
* @return
*/
public String getClientIpAxis() {
MessageContext mc = null;
HttpServletRequest request = null;
try {
mc = MessageContext
if (mc == null)
throw new Exception(
request = (HttpServletRequest) mc
System
} catch (Exception e) {
System
e
}
return request
}
/**
* 獲取客戶端IP地址
* 適用於xfire發布的webservice
* @return
*/
public String getClientIpXfire() {
String ip =
try {
HttpServletRequest request = XFireServletController
ip = request
} catch (Exception e) {
System
e
}
return ip;
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26204.html