hai我是kamal我是android的新手,当我运行我的程序时,我在logcat中出现以下错误中的错误
.plz提供了一种合适的连接和响应方式
03-09 12:00:38.639: WARN/System.err(220): org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://www.w3.org/2001/12/soap-envelope}Envelope (position:START_TAG <html>@1:6 in java.io.InputStreamReader@43d464c0)
03-09 12:00:38.690: WARN/System.err(220): at org.kxml2.io.KXmlParser.exception(KXmlParser.java:245)
03-09 12:00:38.700: WARN/System.err(220): at org.kxml2.io.KXmlParser.require(KXmlParser.java:1376)
03-09 12:00:38.717: WARN/System.err(220): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:127)
03-09 12:00:38.720: WARN/System.err(220): at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
03-09 12:00:38.720: WARN/System.err(220): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
03-09 12:00:38.720: WARN/System.err(220): at com.devstream.http.MainActivity$1.onClick(MainActivity.java:92)
03-09 12:00:38.740: WARN/System.err(220): at android.view.View.performClick(View.java:2364)
03-09 12:00:38.750: WARN/System.err(220): at android.view.View.onTouchEvent(View.java:4179)
03-09 12:00:38.771: WARN/System.err(220): at android.view.View.dispatchTouchEvent(View.java:3709)
03-09 12:00:38.801: WARN/System.err(220): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-09 12:00:38.801: WARN/System.err(220): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-09 12:00:38.811: WARN/System.err(220): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-09 12:00:38.821: WARN/System.err(220): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-09 12:00:38.832: WARN/System.err(220): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-09 12:00:38.841: WARN/System.err(220): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
03-09 12:00:38.850: WARN/System.err(220): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
03-09 12:00:38.860: WARN/System.err(220): at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
03-09 12:00:38.870: WARN/System.err(220): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
03-09 12:00:38.889: WARN/System.err(220): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
03-09 12:00:38.889: WARN/System.err(220): at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 12:00:38.889: WARN/System.err(220): at android.os.Looper.loop(Looper.java:123)
03-09 12:00:38.899: WARN/System.err(220): at android.app.ActivityThread.main(ActivityThread.java:4363)
03-09 12:00:38.912: WARN/System.err(220): at java.lang.reflect.Method.invokeNative(Native Method)
03-09 12:00:38.919: WARN/System.err(220): at java.lang.reflect.Method.invoke(Method.java:521)
03-09 12:00:38.930: WARN/System.err(220): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-09 12:00:38.939: WARN/System.err(220): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-09 12:00:38.959: WARN/System.err(220): at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:0)
看起来您正在尝试连接到SOAP Web服务。但是,Web服务返回HTML响应而不是SOAP响应。您可以使用SOAP UI等工具来测试您的Web服务,然后从您的Android程序中使用它。
答案 1 :(得分:0)
您要发送到soap服务的输入参数可能有错误。确保将输入参数添加到SOAP服务(请求)如下:
SoapObject request = new SoapObject(NAMESPACE, "yourFunctionName");
request.addProperty("dbuser", dbuser); // addProperty rather than addAttribute.
要从SOAP服务(消费部分)获取输出参数:
androidHttpTransport.call("yourFunctionName", env);
SoapObject result = (SoapObject) env.bodyIn;
然后调用getProperty(int)
方法获取您要使用的所有属性。