安装Apache Tomcat,Apache Axis2,创建Web项目,转换为服务,在Tomcat中部署它,然后创建客户端项目,使用我们服务的存根创建客户端,最后访问服务。
我认为这些是在Android Eclipse上使用Web服务的所有步骤 在这里,我已经完成了在tomcat服务器上部署Web项目的步骤,它成功显示了服务,但服务器选项显示为SYNCHRONIZED。它在下面给出
服务器
localhost上的Tomcat v6.0服务器[已启动,已同步]
AndBack [同步]。
同时在创建客户端项目后,它在运行时显示为:
Sorry! The application has stopped unexpectedly. Please try again. Force close
请参考下面给出的logcat。
logcat的
04-25 16:46:51.153: E/dalvikvm(273): Could not find class 'org.ksoap2.serialization.SoapObject', referenced from method org.test.Frontend.AndFrontActivity.onCreate
04-25 16:46:51.153: W/dalvikvm(273): VFY: unable to resolve new-instance 25 (Lorg/ksoap2/serialization/SoapObject;) in Lorg/test/Frontend/AndFrontActivity;
04-25 16:46:51.153: D/dalvikvm(273): VFY: replacing opcode 0x22 at 0x0010
04-25 16:46:51.164: D/dalvikvm(273): VFY: dead code 0x0012-0081 in Lorg/test/Frontend/AndFrontActivity;.onCreate (Landroid/os/Bundle;)V
04-25 16:46:51.243: D/AndroidRuntime(273): Shutting down VM
04-25 16:46:51.243: W/dalvikvm(273): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-25 16:46:51.273: E/AndroidRuntime(273): FATAL EXCEPTION: main
04-25 16:46:51.273: E/AndroidRuntime(273): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
04-25 16:46:51.273: E/AndroidRuntime(273): at org.test.Frontend.AndFrontActivity.onCreate(AndFrontActivity.java:28)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.os.Handler.dispatchMessage(Handler.java:99)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.os.Looper.loop(Looper.java:123)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-25 16:46:51.273: E/AndroidRuntime(273): at java.lang.reflect.Method.invokeNative(Native Method)
04-25 16:46:51.273: E/AndroidRuntime(273): at java.lang.reflect.Method.invoke(Method.java:521)
04-25 16:46:51.273: E/AndroidRuntime(273): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-25 16:46:51.273: E/AndroidRuntime(273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-25 16:46:51.273: E/AndroidRuntime(273): at dalvik.system.NativeStart.main(Native Method)