从远程计算机使用 Web 服务
我有一个使用 jdk 6 构建的桌面应用程序,它发布可供 Web 应用程序使用的 Web 服务。到目前为止,当两个应用程序在同一台物理计算机上运行时,我没有遇到任何问题,我可以毫无问题地访问 wsdl,并且 Web 应用程序与桌面应用程序配合得很好。问题是我无法从同一网络中的远程计算机访问服务。两台PC已连接并且可以交互。如果我在 PC1 中运行这两个应用程序,我可以从 PC2 使用 web 应用程序,通过
http://PC1:8080
我当前发布的方式如下:
public Publicador(){
servicios= new Servicios();
Endpoint endpoint = Endpoint.publish("http://PC1:8686/servicios", servicios);
}
其中 PC1 是电脑的名称。从 PC1 上,我可以从以下地址看到生成的 wsdl,它是我用于 wsimport 命令的:
http://PC1:8686/servicios?wsdl
但我无法从 PC2 上看到。
为什么从 PC1 外部看不到它,有什么想法吗?
I have a desktop application built with jdk 6 which publishes web services to be consumed by a web application. So far I've had no problem while both applications are running in the same physical computer, i can access the wsdl without any problem and the web application works with the desktop application just fine. The thing is I cannot access to the services from a remote computer in the same network. The two PCs are connected and can interact. If I run both applications in PC1, from PC2 I can use the webapp through
http://PC1:8080
I am currently publishing like this:
public Publicador(){
servicios= new Servicios();
Endpoint endpoint = Endpoint.publish("http://PC1:8686/servicios", servicios);
}
where PC1 is the name of the pc. From PC1, i can see the generated wsdl from the following address, and it's the one I used for the wsimport command:
http://PC1:8686/servicios?wsdl
But I cannnot from PC2.
Any ideas why it is not visible from outside PC1?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尽管看起来令人难以置信,但我找到了最简单的答案......而不是像
我发布的
那样发布并解决了它......
另一个解决方案是从文件中获取要发布的地址,这也有效。我不知道为什么它没有硬编码......我最终这样做了:
Incredible as it may seem, I found the simplest of answers... Instead of publishing as
I published as
and that solved it...
Another solution was to get the address to publish from a file, that worked too. I don't know why it didn't hardcoded... I ended up doing it like this: