WebService:Firefox 无法与 192.168.10.203:8080 的服务器建立连接
我正在尝试创建一个网络服务。我无法访问该 URL。如果我尝试连接,
http://192.168.10.203:8080/EchoBeanService/EchoBean?wsdl
则会收到错误:
Firefox can't establish a connection to the server at 192.168.10.203:8080
但是,如果我能够使用 URL 中的 localhost 连接到:
http://localhost:8080/EchoBeanService/EchoBean?wsdl
Echo.java
package services;
public interface Echo {
public String printEcho();
public String printEchoParam(String str);
}
EchoBean.java 封装型号;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import services.Echo;
@Stateless
@WebService
public class EchoBean implements Echo {
public EchoBean(){}
@WebMethod
public String printEcho(){
return "WebServices Echo ";
}
@WebMethod
public String printEchoParam(String str){
return ("In PrintEcho( String " + str +" )" );
}
}
-H
I am trying to create a WebService. I am not able to access the URL. If I try to connect to
http://192.168.10.203:8080/EchoBeanService/EchoBean?wsdl
I get an error:
Firefox can't establish a connection to the server at 192.168.10.203:8080
However, if I am able to connect to the using localhost in the URL:
http://localhost:8080/EchoBeanService/EchoBean?wsdl
Echo.java
package services;
public interface Echo {
public String printEcho();
public String printEchoParam(String str);
}
EchoBean.java
package model;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import services.Echo;
@Stateless
@WebService
public class EchoBean implements Echo {
public EchoBean(){}
@WebMethod
public String printEcho(){
return "WebServices Echo ";
}
@WebMethod
public String printEchoParam(String str){
return ("In PrintEcho( String " + str +" )" );
}
}
-H
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我对 java 完全一无所知,但这种症状似乎并不是 Web 服务所特有的。也许与此 java 应用程序或默认仅绑定到 localhost:8080 或监听 localhost:8080 的服务器有关?也许这将有助于改变这一点:如何更改 webservice url 端点?
类似说明,特别是“部署 Web 服务”部分:http://today.java.net/article/2006/06/12/web-services-made-easy-jax-ws-20
否则,就像上面的人所说:检查您的本地防火墙以查看传入连接是否被阻止,或验证分配给运行此服务的系统的 IP 地址。
I have absolutely no knowledge of java, but this symptom doesn't seem all that unique to web services in general. Maybe something to do with either this java app or the server by default binding only to or listening at localhost:8080? Maybe this would help to change that: How to change webservice url endpoint?
Similar instructions, specifically the 'Deploying the Web Service' section: http://today.java.net/article/2006/06/12/web-services-made-easy-jax-ws-20
Otherwise, like folks said above: check your local firewall to see if incoming connections are blocked, or verify the IP addressed assigned to the system this service is running on.
检查以下内容:
Check the following:
此外,出于安全原因,某些应用程序服务器默认禁用远程连接。您的服务器可能必须设置为允许远程连接。
您可以使用 telnet 连接到端口来检查网络连通性。
Also some application servers disable remote connections by default for security reasons. Your server might have to be setup to allow remote connections.
You can check network connectivity by using telnet to connect to the port.
如果您在 Linux 上运行,您可能会被 IPTABLE 阻止。尝试禁用它并查看是否可以从远程 IP/主机名进行连接。
不管怎样,这看起来像是防火墙问题或 IP 地址不正确。
使用 ifconfig(基于 unix)或 ipconfig(win)查找您的 IP 地址
If you are running on Linux you might be blocked by IPTABLE. Try to disable that and see if you can connect from your remote IP/Hostname.
Either way it seems like a firewall issues or incorrect IP address.
Look up your IP Address with ifconfig (unix based) or ipconfig (win)
如果这是一个家庭网络,我知道某些路由器/调制解调器不喜欢环回自身(我在 linksys 设备上看到过这种行为)。但 localhost 仍然可以工作,因为操作系统在它发送到网络设备之前捕获了它。您是否尝试过连接到计算机上的任何其他端口,或者只是对 IP 地址执行 ping 操作以查看其是否响应?
If this is a home network, I know that some routers/modems don't like looping back to themselves (I have seen this behavior with linksys devices). But localhost still works, because the OS catches it before it goes out to the network appliance. Have you tried connecting to any other ports on your machine, or just doing a ping of the IP address to see if it responds?
谢谢大家,
通过重新安装我的 glassfish 服务器解决了这个问题。
Thank you all,
Resolved the issue by reinstalling my glassfish server.