I can't connect to sql server via asp.net from android -
i'm using ksoap2 libs in apps.
there 3 webmethod in asp.net file. 1 methods sql server query, rests kinds of helloworld, adding 2 numbers.
i checked asp worked in vs 2012. 3 methods worked well. problem when running android app, 2 methods working properly. method sql server throwing errors:
05-25 13:35:46.630 8269-8478/com.example.bruce.xmlwork w/system.err: soapfault - faultcode: 'soap:server' faultstring: 'server unable process request. ---> network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: tcp provider, error: 0 - access denied.) ---> access denied' faultactor: 'null' detail: org.kxml2.kdom.node@241d2389 05-25 13:35:46.630 8269-8478/com.example.bruce.xmlwork w/system.err: @ org.ksoap2.serialization.soapserializationenvelope.parsebody(soapserializationenvelope.java:137) 05-25 13:35:46.630 8269-8478/com.example.bruce.xmlwork w/system.err:
@ org.ksoap2.soapenvelope.parse(soapenvelope.java:140) 05-25 13:35:46.630 8269-8478/com.example.bruce.xmlwork w/system.err: @ org.ksoap2.transport.transport.parseresponse(transport.java:129) 05-25 13:35:46.630 8269-8478/com.example.bruce.xmlwork w/system.err: @ org.ksoap2.transport.httptransportse.parseresponse(httptransportse.java:301) 05-25 13:35:46.630 8269-8478/com.example.bruce.xmlwork w/system.err:
@ org.ksoap2.transport.httptransportse.call(httptransportse.java:274) 05-25 13:35:46.660 8269-8478/com.example.bruce.xmlwork w/system.err:
@ org.ksoap2.transport.httptransportse.call(httptransportse.java:118) 05-25 13:35:46.660 8269-8478/com.example.bruce.xmlwork w/system.err:
@ org.ksoap2.transport.httptransportse.call(httptransportse.java:113) 05-25 13:35:46.670 8269-8478/com.example.bruce.xmlwork w/system.err:
@ com.example.bruce.xmlwork.mainactivity.readdata(mainactivity.java:156) 05-25 13:35:46.690 8269-8478/com.example.bruce.xmlwork w/system.err:
@ com.example.bruce.xmlwork.mainactivity$myasynctask.doinbackground(mainactivity.java:101) 05-25 13:35:46.690 8269-8478/com.example.bruce.xmlwork w/system.err:
@ com.example.bruce.xmlwork.mainactivity$myasynctask.doinbackground(mainactivity.java:89) 05-25 13:35:46.690 8269-8478/com.example.bruce.xmlwork w/system.err:
@ android.os.asynctask$2.call(asynctask.java:288) 05-25 13:35:46.690 8269-8478/com.example.bruce.xmlwork w/system.err: @ java.util.concurrent.futuretask.run(futuretask.java:237) 05-25 13:35:46.690 8269-8478/com.example.bruce.xmlwork w/system.err: @ android.os.asynctask$serialexecutor$1.run(asynctask.java:231) 05-25 13:35:46.690 8269-8478/com.example.bruce.xmlwork w/system.err: @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) 05-25 13:35:46.690 8269-8478/com.example.bruce.xmlwork w/system.err:
@ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587)
protected string readdata(){ log.d("ddd","readdata"); soapobject request = new soapobject(namespace, method_name); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.setoutputsoapobject(request); envelope.dotnet = true; httptransportse ht = new httptransportse(url); try { ht.call(soap_action, envelope); //error occours soapprimitive response = (soapprimitive)envelope.getresponse(); return response.tostring(); } catch (exception e) { e.printstacktrace(); } return "no"; }
how solve this.. please me.
----added----- in asp.net
[webmethod] public string returnname() { string strsql = "select * address"; sqlconnection objcon = new sqlconnection(); objcon.connectionstring = "data source=192.168.13.79,1433;initial catalog=brucebasic;user id=sa;password=***"; objcon.open(); sqlcommand objcmd = new sqlcommand(); objcmd.connection = objcon; objcmd.commandtext = strsql; objcmd.commandtype = commandtype.text; sqldataadapter adapter = new sqldataadapter(); adapter.selectcommand = objcmd; dataset tempds = new dataset("temp"); adapter.fill(tempds); objcon.close(); return tempds.tables[0].rows[0]["addr_city"].tostring(); }
and allowed remote connection in db properies.
Comments
Post a Comment