我构建了一个最小的Web服务,并使用javax.xml.ws.Endpoint发布它。如果我试图在http://localhost:1234/AddService?wsdl
获得WSDL它工作正常。
试图在qazxsw poi收到它,我什么都收不到。该地址与localhost相同。
是否有可能在不提供地址的情况下发布Web服务?
http://192.168.0.133:1234/AddService?wsdl
将代码更改为
package test;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
@WebService
public class AddService {
@WebMethod
public int add(int a, int b){
return a+b;
}
public static void main(String[] args ){
Endpoint.publish("http://localhost:1234/AddService", new AddService());
}
}
获取IP地址上的wsdl但不是localhost。
是否有可能只定义端口?
你能尝试在0.0.0.0上发布吗?
这是我的代码:
Endpoint.publish(“Endpoint.publish("http://192.168.0.133:1234/AddService", new AddService());
”,新的ServiceController());
它说地址的路径应该以/开头