Permission denied (maybe missing INTERNET permission) when calling web service
Posted
by
Maxim
on Stack Overflow
See other posts from Stack Overflow
or by Maxim
Published on 2010-06-07T14:32:38Z
Indexed on
2011/11/15
9:51 UTC
Read the original article
Hit count: 395
android
|web-services
I'm trying to use .net SOAP web service with ksoap2 lib. Example from http://www.vimeo.com/9633556 shows how to do it correct. Below the code from that example. everything shoud work ok, but when I try to do a call inself (httpTransport.call) I get "Permission denied (maybe missing INTERNET permission)" exception. Moreover, I don't see in the Application info window among permissions the internet permission alert. Tried this on emulator and Google phone. Will be very appreciated if somebody could help with it. Thanks.
public void CelsiusToFahrenheit()
{
String SOAP_ACTION = "http://tempuri.org/CelsiusToFahrenheit";
String METHOD_NAME = "CelsiusToFahrenheit";
String NAMESPACE = "http://tempuri.org/";
String URL = "http://www.w3schools.com/webservices/tempconvert.asmx";
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
Request.addProperty("Celsius", "32");
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL);
try
{
httpTransport.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
res = resultString.toString();
}
catch (Exception e) {
e.printStackTrace();
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<application>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<user-permission android:name="android.permission.INTERNET"></user-permission>
<uses-sdk android:minSdkVersion="4" />
© Stack Overflow or respective owner