首页 > WebService:使用JDK发布WebService,但使用本机IP无法访问?

WebService:使用JDK发布WebService,但使用本机IP无法访问?

使用JDK发布WebService

Endpoint.publish("http://localhost:8000/server", new Printer());

则通过

http://localhost:8000/server
http://127.0.0.1:8000/server

可获取相应的wsdl

本机(Win7)IP为:192.168.1.78,改为使用本机IP重新发布

Endpoint.publish("http://192.168.1.78:8000/server", new Printer());

则通过

http://192.168.1.78:8000/server

可获取相应的wsdl,而通过

http://localhost:8000/server
http://127.0.0.1:8000/server

却不能访问了

在我看来192.168.1.78、localhost、127.0.0.1应该都能访问该wsdl,但为何会造成这种问题呢?现在不知道该用哪个地址来发布了


可以试试0.0.0.0来发布

【热门文章】
【热门文章】