Call webservice from Android using KSoap just returning the string "error"

I am trying to use ksoap to call a simple web service. I followed this video to try and get started. When I call "getResponse ()" on the envelope, I just get the line "Error". No exceptions or other details. I have successfully connected to a simple web service that I just installed on my local machine. Could this be due to the fact that he is behind a proxy 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();
}

      

+2


a source to share


2 answers


It turns out that I missed the '/' after the namespace. Took me too long to figure it out.



+1


a source


You should write a namespace like this.



String NAMESPACE = "http://tempuri.org"/;

      

+1


a source







All Articles