Reputation: 1
I´m using ksoap to connect toa webservice but I have a problem when I try to get a value from my webservice.
I got this error exception java.net.SocketTimeoutException: connect timed out
I already check the timeout solution and it still doesn´t work
Also I've already made sure that my METHOD,NAMESPACE and URL are correct according to my WSDL file.
Do you have any other solution?
Here is my code:
class SegundoPlano extends 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;
}
Upvotes: 0
Views: 211
Reputation: 449
Are you sure following is valid soap service URL?
String URL = "http://www.example.com/Servicios_web/WebService.asmx";
Do you have stack trace of where the call fails?
Upvotes: 0