【问题标题】:Android webservices connection refusedAndroid网络服务连接被拒绝
【发布时间】:2013-07-22 17:30:57
【问题描述】:

我正在尝试使用以下代码从 android 访问 RESTful 网络服务。

ClientConfig config= new DefaultClientConfig();
    Client client=Client.create(config);
    WebResource service=client.resource("http://localhost:8085/JerseyTest/jersey/test/testing123");

但我得到以下异常。

07-22 16:53:15.450: E/AndroidRuntime(1491): 由: com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: 无法连接到 localhost/127.0.0.1 (端口 8085):连接失败:ECONNREFUSED(连接被拒绝)

但是该网址在浏览器中运行良好,我也尝试关闭防火墙。任何人都可以帮助我吗?

【问题讨论】:

    标签: android web-services rest


    【解决方案1】:

    我认为,您应该通过拥有 WebService 的计算机的 ip 更改 localhost

    【讨论】:

      【解决方案2】:

      检查你是否添加了所有需要的权限并尝试IP地址而不是localhost

      【讨论】:

        猜你喜欢
        • 2014-10-10
        • 1970-01-01
        • 2011-06-24
        • 2011-02-02
        • 2019-06-01
        • 2011-06-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多