0
04-14 22:09:40.158: E/REQUEST=(274): Authenticate{Username=lll; }
04-14 22:09:40.158: E/SOAP ENVOLP=(274): **envolpe=org.ksoap2.serialization.SoapSerializationEnvelope@43e5b748
04-14 22:09:43.799: W/System.err(274): org.xmlpull.v1.XmlPullParserException: unexpected type (position:TEXT 
04-14 22:09:43.799: W/System.err(274): Warning: DOMXPa...@27:1 in java.io.InputStreamReader@43e6ec48)** 
04-14 22:09:43.819: W/System.err(274):  at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)
04-14 22:09:43.819: W/System.err(274):  at org.kxml2.io.KXmlParser.nextTag(KXmlParser.java:1420)
04-14 22:09:43.819: W/System.err(274):  at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:126)
04-14 22:09:43.819: W/System.err(274):  at org.ksoap2.transport.Transport.parseResponse(Transport.java:90)
04-14 22:09:43.819: W/System.err(274):  at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:179)
04-14 22:09:43.819: W/System.err(274):  at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:90)
04-14 22:09:43.829: W/System.err(274):  at com.dev.coaster.SignIn.onClick(SignIn.java:71)
04-14 22:09:43.829: W/System.err(274):  at android.view.View.performClick(View.java:2408)
04-14 22:09:43.829: W/System.err(274):  at android.view.View$PerformClick.run(View.java:8816)
04-14 22:09:43.829: W/System.err(274):  at android.os.Handler.handleCallback(Handler.java:587)
04-14 22:09:43.829: W/System.err(274):  at android.os.Handler.dispatchMessage(Handler.java:92)
04-14 22:09:43.829: W/System.err(274):  at android.os.Looper.loop(Looper.java:123)
04-14 22:09:43.829: W/System.err(274):  at android.app.ActivityThread.main(ActivityThread.java:4627)
04-14 22:09:43.829: W/System.err(274):  at java.lang.reflect.Method.invokeNative(Native Method)
04-14 22:09:43.839: W/System.err(274):  at java.lang.reflect.Method.invoke(Method.java:521)
04-14 22:09:43.839: W/System.err(274):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-14 22:09:43.839: W/System.err(274):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-14 22:09:43.839: W/System.err(274):  at dalvik.system.NativeStart.main(Native Method)
**04-14 22:09:43.839: E/SOAP Result=(274): result=null**

我的 SOAP 解析代码是:-

 SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);    
 request.addProperty("Username","lll");

 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
 envelope.dotNet = true;
 envelope.setOutputSoapObject(request);

            Log.e("REQUEST=",""+request);
            Log.e("SOAP ENVOLP=","envolpe="+envelope);
            // Make the soap call.
            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
            try {

                //this is the actual part that will call the webservice
                androidHttpTransport.debug = true;
                androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                androidHttpTransport.call(SOAP_ACTION, envelope);        

                getResult = envelope.getResponse().toString();
            } catch (Exception e) {
                e.printStackTrace(); 
            }

            // Get the SoapResult from the envelope body.       
            SoapObject result = (SoapObject)envelope.bodyIn;

              Log.e("SOAP Result=","result="+result);
4

1 回答 1

2

认证方法需要复杂的对象!一个名为“Authenticate”的属性和两个名为“Username”和“Password”的嵌套属性。您必须创建一个复杂的对象,以便在根属性内嵌套属性。看看这里: 在 Ksoap2 中的标签内嵌套属性

于 2013-04-15T08:19:12.627 回答