Note that there are some explanatory texts on larger screens.

plurals
  1. PONothing happening when calling a .NET web service in Android
    primarykey
    data
    text
    <p>I have developed a web service in .net, here it is</p> <pre><code>[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] public class DataManipulationService : System.Web.Services.WebService { [WebMethod] public void InsertData() { SQLConnectionManager conn = new SQLConnectionManager(); string qry = "INSERT INTO TEST_TABLE(Id, Name) VALUES(3, 'Ibbi')"; SQLOperationManager op = new SQLOperationManager(qry); int rowsAffected = op.ExecuteQuery(); } } </code></pre> <p>and I'm trying to call this web method from android, like this</p> <pre><code>public class WebDataManipulator { private final String NAMESPACE = "http://tempuri.org/"; private final String URL = "http://localhost/DataManipulationService.asmx?WSDL"; private final String METHOD = "InsertData"; private final String SOAP_ACTION = "http://localhost/DataManipulationService.asmx?op=InsertData"; public void insertData() { SoapObject request = new SoapObject(NAMESPACE, METHOD); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); System.out.println(request); HttpTransportSE androidHttp = new HttpTransportSE(URL); try { androidHttp.call(SOAP_ACTION, envelope); } catch(Exception ex) { ex.printStackTrace(); } } </code></pre> <p>}</p> <p>I have tested my web service in .net and its working fine but when I run this on android NOTHING HAPPENS.. neither I'm getting any exception nor its functioning. Why? This is my logcat</p> <pre><code>08-11 11:09:12.269: I/AndroidRuntime(325): NOTE: attach of thread 'Binder Thread #3' failed 08-11 11:09:13.179: I/System.out(333): InsertData{} 08-11 11:09:13.229: W/System.err(333): java.net.SocketException: Permission denied 08-11 11:09:13.239: W/System.err(333): at org.apache.harmony.luni.platform.OSNetworkSystem.socket(Native Method) 08-11 11:09:13.239: W/System.err(333): at dalvik.system.BlockGuard$WrappedNetworkSystem.socket(BlockGuard.java:335) 08-11 11:09:13.239: W/System.err(333): at org.apache.harmony.luni.net.PlainSocketImpl.create(PlainSocketImpl.java:216) 08-11 11:09:13.249: W/System.err(333): at java.net.Socket.checkOpenAndCreate(Socket.java:802) 08-11 11:09:13.249: W/System.err(333): at java.net.Socket.connect(Socket.java:948) 08-11 11:09:13.249: W/System.err(333): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.&lt;init&gt;(HttpConnection.java:75) 08-11 11:09:13.249: W/System.err(333): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.&lt;init&gt;(HttpConnection.java:48) 08-11 11:09:13.249: W/System.err(333): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322) 08-11 11:09:13.249: W/System.err(333): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89) 08-11 11:09:13.249: W/System.err(333): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285) 08-11 11:09:13.249: W/System.err(333): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267) 08-11 11:09:13.249: W/System.err(333): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:205) 08-11 11:09:13.249: W/System.err(333): at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:76) 08-11 11:09:13.249: W/System.err(333): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:146) 08-11 11:09:13.249: W/System.err(333): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95) 08-11 11:09:13.249: W/System.err(333): at com.automated.research.WebDataManipulator.insertData(WebDataManipulator.java:27) 08-11 11:09:13.259: W/System.err(333): at com.automated.research.DataSender$1.run(DataSender.java:47) 08-11 11:09:13.259: I/System.out(333): connected </code></pre> <p>and this is how I write the client code</p> <pre><code>if(isNetworkAvailable()) { WebDataManipulator webDM = new WebDataManipulator(); webDM.insertData(); System.out.println("connected"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload