I am learning how to use Web services on a mobile platform (specifically Android) with KSOAP. However, I seem to be running into a problem when creating a SoapObject
.
String NAMESPACE = "http://webservicesx.net/";
String METHOD_NAME = "ChangeMetricWeightUnit";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
String URL = "http://173.201.44.188/convertMetricWeight.asmx";
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
My code crashes on application start and debugging has shown that the SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
throws an InvocationTargetException
.
My LogCat is as follows:
06-06 19:53:18.900: E/AndroidRuntime(995): FATAL EXCEPTION: main
06-06 19:53:18.900: E/AndroidRuntime(995): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
06-06 19:53:18.900: E/AndroidRuntime(995): at org.hcfcd.webtest.WebServicesTest.onCreate(WebServicesTest.java:31)
06-06 19:53:18.900: E/AndroidRuntime(995): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-06 19:53:18.900: E/AndroidRuntime(995): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-06 19:53:18.900: E/AndroidRuntime(995): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-06 19:53:18.900: E/AndroidRuntime(995): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-06 19:53:18.900: E/AndroidRuntime(995): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-06 19:53:18.900: E/AndroidRuntime(995): at android.os.Handler.dispatchMessage(Handler.java:99)
06-06 19:53:18.900: E/AndroidRuntime(995): at android.os.Looper.loop(Looper.java:130)
06-06 19:53:18.900: E/AndroidRuntime(995): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-06 19:53:18.900: E/AndroidRuntime(995): at java.lang.reflect.Method.invokeNative(Native Method)
06-06 19:53:18.900: E/AndroidRuntime(995): at java.lang.reflect.Method.invoke(Method.java:507)
06-06 19:53:18.900: E/AndroidRuntime(995): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-06 19:53:18.900: E/AndroidRuntime(995): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-06 19:53:18.900: E/AndroidRuntime(995): at dalvik.system.NativeStart.main(Native Method)
From what I can tell from the LogCat, the compiler couldn't find the SoapObject class despite the fact that I imported the KSOAP.jar into the project.