我正在使用ksoap连接到Web服务,但是当我尝试从Web服务获取价值时遇到了问题。
我收到此错误异常java.net.SocketTimeoutException:连接超时
我已经检查了超时解决方案,但仍然无法正常工作
根据我的WSDL文件,我已经确保我的METHOD,NAMESPACE和URL是正确的。
您还有其他解决方案吗?
这是我的代码:
SegundoPlano类扩展了AsyncTask {
@Override
protected Void doInBackground(Void... voids) {
logeo();
return null;
}
@Override
protected void onPostExecute(Void result) {
if (Re.compareTo("true") == 0) {
// try {
Intent I = new Intent(getApplicationContext(), Menu.class);
I.putExtra("folioen", Usuario);
startActivity(I);
// }
// catch (Exception ex)
//{
// Toast.makeText(MainActivity.this,ex.getMessage(), Toast.LENGTH_LONG);
// }
}
}
}
private String logeo() {
String mensaje;
String URL = "http://www.example.com/Servicios_web/WebService.asmx";
String metodo = "Acceso";
String namespace = "http://tempuri.org/";
String Accion = "http://tempuri.org/Access";
try {
SoapObject obtencion = new SoapObject(namespace, metodo);
obtencion.addProperty("usuario", User);
obtencion.addProperty("contra", Password);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(obtencion);
//HttpsTransportSE transporte = new KeepAliveHttpsTransportSE("192.168.4.38",440,"SERVIEPATH",7000);
HttpTransportSE transporte = new HttpTransportSE(URL, 100000);
transporte.call(Accion, soapEnvelope);
SoapPrimitive resultado = (SoapPrimitive) soapEnvelope.getResponse();
mensaje = resultado.toString();
Re = resultado.toString();
} catch (Exception ex) {
mensaje = ex.getMessage();
}
return mensaje;
}
答案 0 :(得分:0)
您确定以下是有效的肥皂服务网址吗?
String URL = "http://www.example.com/Servicios_web/WebService.asmx";
您是否有调用失败的堆栈跟踪记录?