Call webservice from Android using KSoap simply returning "error" string

Posted by w00tfest99 on Stack Overflow See other posts from Stack Overflow or by w00tfest99
Published on 2010-04-26T21:57:47Z Indexed on 2010/04/26 22:03 UTC
Read the original article Hit count: 510

Filed under:
|
|
|

I'm trying to use ksoap to call a simple webservice. I followed this video to try to get started. When I call "getResponse()" on the envelope I just get the string "Error". There's no exceptions thrown or any other detail. I've successfully connected to a simple webservice I just setup on my local machine. Could this potentially be related to being behind a proxy server here at work? My code is below:

String SOAP_ACTION="http://tempuri.org/CelsiusToFahrenheit";
String METHOD_NAME = "CelsiusToFahrenheit";
String NAMESPACE = "http://tempuri.org";
String URL = "http://w3schools.com/webservices/tempconvert.asmx";

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo pi = new PropertyInfo();
pi.setName("Celsius");
pi.setValue("32");
request.addProperty(pi);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);

HttpTransportSE aht = new HttpTransportSE(URL);

try
{
    aht.call(SOAP_ACTION, envelope);
    SoapPrimitive results = (SoapPrimitive)envelope.getResponse();
}
catch (Exception e)
{
    e.printStackTrace();
}

© Stack Overflow or respective owner

Related posts about android

Related posts about ksoap2