0
我通过实现这样的接口写入(Java 6中)一个简单的Web服务:JWS检索当Web服务被称为IP地址
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService
@SOAPBinding(style = Style.RPC)
public interface MyWebService {
@WebMethod
String helloWorld();
}
所以,我的具体类是一样的东西:
import javax.jws.WebService;
@WebService(endpointInterface="xxx",
portName="yyy",
serviceName="zzz")
public class MyConcreteWS implements MyWebService {
@Override
public String helloWorld() {
// ...
}
}
现在,在方法的helloWorld()我怎么能检索有关来电者的任何信息,例如像IP地址?
我没有开发一个servlet,它只是一个简单的罐子,里面有一个主要的方法。
不幸的是,它不起作用。我在调用对象* req *上的方法* getRemoteAddr()*时检索'NullPointerException'。 –