简体   繁体   中英

Call Web Service in Android application

I want to call .net web service into Android application. For that I am using running web service available on net called "www.w3schools.com/webservices/tempconvert.asmx"

It's running successfully with browser, but when I call it in my Android application it gives me error in my tab device. The log cat info is shown below:

06-08 17:27:16.351: E/dalvikvm(5767): Could not find class   'org.ksoap2.serialization.SoapObject', referenced from method com.example.wscallingapk.WS_MainActivity.onCreate

06-08 17:27:22.612: E/AndroidRuntime(5767): FATAL EXCEPTION: main
06-08 17:27:22.612: E/AndroidRuntime(5767): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
06-08 17:27:22.612: E/AndroidRuntime(5767):     at com.example.wscallingapk.WS_MainActivity.onCreate(WS_MainActivity.java:37)

06-08 17:27:22.612: E/AndroidRuntime(5767):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-08 17:27:22.612: E/AndroidRuntime(5767):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-08 17:27:22.612: E/AndroidRuntime(5767):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-08 17:27:22.612: E/AndroidRuntime(5767):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 17:27:22.612: E/AndroidRuntime(5767):     at android.os.Looper.loop(Looper.java:123)
06-08 17:27:22.612: E/AndroidRuntime(5767):     at android.app.ActivityThread.main(ActivityThread.java:4627)
06-08 17:27:22.612: E/AndroidRuntime(5767):     at java.lang.reflect.Method.invokeNative(Native Method)
06-08 17:27:22.612: E/AndroidRuntime(5767):     at java.lang.reflect.Method.invoke(Method.java:521)
06-08 17:27:22.612: E/AndroidRuntime(5767):     at java.lang.reflect.Method.invoke(Method.java:521)
06-08 17:27:22.612: E/AndroidRuntime(5767):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)

06-08 17:27:22.612: E/AndroidRuntime(5767):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
06-08 17:27:22.612: E/AndroidRuntime(5767):     at dalvik.system.NativeStart.main(Native Method)

ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar

Download this library from this Link

and put it into your lib folder of your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM