I'm actually using a WebService from W3School for testing, and I have this method:
public static float getCelsius(int Fahrenheit)
{
String SOAP_ACTION = "http://www.w3schools.com/xml/FahrenheitToCelsius";
String METHOD_NAME = "FahrenheitToCelsius";
String NAMESPACE = "http://www.w3schools.com/xml/";
String URL = "http://www.w3schools.com/xml/tempconvert.asmx";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("Fahrenheit", Fahrenheit);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
try {
HttpTransportSE transport = new HttpTransportSE(URL);
transport.call(SOAP_ACTION, envelope);
SoapPrimitive result = (SoapPrimitive)envelope.getResponse();
return Float.parseFloat(result.toString());
} catch(Exception e) {
return 0;
}
}
But it doesn't works, always returns 0.
I set the internet permission in AndroidManifest.xml
like this:
<uses-permission android:name="android.permission.INTERNET" />
I'm using AVD emulator, but I also tried running the app in my tablet: didn't work.
Any help? Sorry for bad english, I hope you understand.