Java 连接失败:少数Anfroid设备上存在ECONREFUNCE问题
我开发了一个使用Web服务的Android应用程序。我已经在不同的设备上测试了这个应用程序,它工作得很好,但是在我客户的平板电脑上,它抛出了一个异常。测试应用程序的所有设备都运行Android 6.0.1棉花糖Java 连接失败:少数Anfroid设备上存在ECONREFUNCE问题,java,android,web-services,android-ksoap2,ksoap,Java,Android,Web Services,Android Ksoap2,Ksoap,我开发了一个使用Web服务的Android应用程序。我已经在不同的设备上测试了这个应用程序,它工作得很好,但是在我客户的平板电脑上,它抛出了一个异常。测试应用程序的所有设备都运行Android 6.0.1棉花糖 java.net.ConnectException: failed to connect to web.abc.com(port 80):connect failed: ECONNREFUSED (Connection refused) 以下是我使用Webservice的代码 Stri
java.net.ConnectException: failed to connect to web.abc.com(port 80):connect failed: ECONNREFUSED (Connection refused)
以下是我使用Webservice的代码
String namespace = "http://web.abc.com/";
private static final String url = "http://web.abc.com/WebService/ServiceFileName.asmx";
String SOAP_ACTION;
SoapObject request = null, objMessages = null;
SoapSerializationEnvelope envelope;
HttpTransportSE androidHttpTransport;
/**
* Set Envelope
*/
protected void SetEnvelope() {
try {
// Creating SOAP envelope
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
//You can comment that line if your web service is not .NET one.
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
//envelope.addMapping(namespace, "ProductStausResponse",new ProductStausResponse().getClass());
androidHttpTransport = new HttpTransportSE(url);
androidHttpTransport.debug = true;
} catch (Exception e) {
e.printStackTrace();
Log.v("Soap Exception", e.toString());
System.out.println("Soap Exception---->>>" + e.toString());
}
}
// MethodName variable is define for which webservice function will call
public String getProductStatus(String MethodName, String Parameter)
{
try {
ProductCode = ProductCode.trim();
SOAP_ACTION = namespace + MethodName;
//Adding values to request object
request = new SoapObject(namespace, MethodName);
/// Code for setting properties
SetEnvelope();
try {
//SOAP calling webservice
androidHttpTransport.call(SOAP_ACTION, envelope);
//Got Webservice response
String result = envelope.getResponse().toString();
return result;
} catch (Exception e) {
// TODO: handle exception
//e.printStackTrace();
//return "Exception";
return e.toString();
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
Log.v("Soap Exception", e.toString());
//return "Exception";
return e.toString();
}
}
您在清单中有internet权限吗?是的,应用程序在清单中有internet权限。您可以显示整个stacktrace吗?非常抱歉,我无法提供stacktrace,因为客户端离我很远,我无法在我这边生成此错误。您在清单中有internet权限吗?是,应用程序在清单中具有Internet权限。您可以显示整个stacktrace吗?非常抱歉,我无法提供stacktrace,因为客户端离我很远,我无法在我这边生成此错误。