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,但为何会造成这种问题呢?现在不知道该用哪个地址来发布了

阅读 6.2k
1 个回答

可以试试0.0.0.0来发布

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题