Note that there are some explanatory texts on larger screens.

plurals
  1. POConnecting to C# asp.net using Ksoap2 in Android
    primarykey
    data
    text
    <p>I'm trying to connect to my asp web service and get the response using this codes. It gives no error but it's not connecting to my web service either. Can anyone point my mistake? thanks</p> <pre><code>public class MainActivity extends Activity { private static final String SOAP_ACTION = "http://tempuri.org/MyFirstWebMethod"; private static final String OPERATION_NAME = "MyFirstWebMethod"; private static final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/"; private static final String SOAP_ADDRESS = "http://10.0.2.2:1595/test.asmx"; String name = "Test"; String last = "Me"; String result; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ((Button) findViewById(R.id.btngo)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, OPERATION_NAME); request.addProperty("name", name); request.addProperty("last", last); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet=true; envelope.setOutputSoapObject(request); HttpTransportSE ht = new HttpTransportSE(SOAP_ADDRESS); try { ht.call(SOAP_ACTION, envelope); SoapObject response = (SoapObject)envelope.getResponse(); result = response.getProperty(1).toString(); } catch (Exception e) { e.printStackTrace(); } Toast.makeText(getBaseContext(), ""+result, Toast.LENGTH_LONG).show(); } }); } } </code></pre> <p>this is what the log cat said</p> <pre><code>11-08 13:15:00.344: I/Choreographer(977): Skipped 58 frames! The application may be doing too much work on its main thread. 11-08 13:15:00.405: W/System.err(977): android.os.NetworkOnMainThreadException 11-08 13:15:00.405: W/System.err(977): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117) 11-08 13:15:00.413: W/System.err(977): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84) 11-08 13:15:00.413: W/System.err(977): at libcore.io.IoBridge.connectErrno(IoBridge.java:127) 11-08 13:15:00.413: W/System.err(977): at libcore.io.IoBridge.connect(IoBridge.java:112) 11-08 13:15:00.413: W/System.err(977): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) 11-08 13:15:00.413: W/System.err(977): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459) 11-08 13:15:00.413: W/System.err(977): at java.net.Socket.connect(Socket.java:842) 11-08 13:15:00.413: W/System.err(977): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:76) 11-08 13:15:00.413: W/System.err(977): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:50) 11-08 13:15:00.413: W/System.err(977): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:341) 11-08 13:15:00.413: W/System.err(977): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87) 11-08 13:15:00.413: W/System.err(977): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) 11-08 13:15:00.413: W/System.err(977): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315) 11-08 13:15:00.413: W/System.err(977): at libcore.net.http.HttpEngine.connect(HttpEngine.java:310) 11-08 13:15:00.413: W/System.err(977): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289) 11-08 13:15:00.437: W/System.err(977): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239) 11-08 13:15:00.437: W/System.err(977): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80) 11-08 13:15:00.437: W/System.err(977): at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:75) 11-08 13:15:00.437: W/System.err(977): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:136) 11-08 13:15:00.437: W/System.err(977): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:90) 11-08 13:15:00.437: W/System.err(977): at com.example.xmlparser.MainActivity$1.onClick(MainActivity.java:39) 11-08 13:15:00.443: W/System.err(977): at android.view.View.performClick(View.java:4084) 11-08 13:15:00.443: W/System.err(977): at android.view.View$PerformClick.run(View.java:16966) 11-08 13:15:00.443: W/System.err(977): at android.os.Handler.handleCallback(Handler.java:615) 11-08 13:15:00.443: W/System.err(977): at android.os.Handler.dispatchMessage(Handler.java:92) 11-08 13:15:00.443: W/System.err(977): at android.os.Looper.loop(Looper.java:137) 11-08 13:15:00.443: W/System.err(977): at android.app.ActivityThread.main(ActivityThread.java:4745) 11-08 13:15:00.443: W/System.err(977): at java.lang.reflect.Method.invokeNative(Native Method) 11-08 13:15:00.453: W/System.err(977): at java.lang.reflect.Method.invoke(Method.java:511) 11-08 13:15:00.453: W/System.err(977): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 11-08 13:15:00.453: W/System.err(977): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 11-08 13:15:00.453: W/System.err(977): at dalvik.system.NativeStart.main(Native Method) 11-08 13:15:00.618: I/Choreographer(977): Skipped 49 frames! The application may be doing too much work on its main thread. </code></pre>
    singulars
    1. This table or related slice is empty.
    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