我試圖訪問一個.NET webservice使用ksoap2,但我不知道它爲什麼不工作。如何連接到.net web服務使用ksoap2 android
我已經閱讀了很多教程,但仍然無法正常工作。 總是出現錯誤:
at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)
at org.kxml2.io.KXmlParser.nextTag(KXmlParser.java:1413)
at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:126)
at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
at br.android.listgame.Activitys.ListSimpleActivity.onCreate(ListSimpleActivity.java:108)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1660)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1721)
at android.app.ActivityThread.access$1500(ActivityThread.java:124)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:968)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3844)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
我已經在使用的soapUI測試web服務和它的正常工作。
SoapObject soap = new SoapObject(NAMESPACE, OPERATION);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soap.addProperty("nome", "artur");
envelope.dotNet = true;
envelope.setOutputSoapObject(soap);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
try {
httpTransport.call(SOAP_ACTION, envelope);
resposta = envelope.getResponse().toString();
} catch (IOException ioex) {
ioex.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}
我已經將.jar添加到項目並添加爲庫,並且我也設置了使用互聯網的權限。
我使用的是Android 2.2的
請顯示引發異常的行。 – 2012-04-25 02:22:35
httpTransport.call(SOAP_ACTION,envelope); – FilipeFaria 2012-04-25 02:32:07