我使用KSOAP在我的應用程序調用一個webservices.In是我得到一些exception.I我用下面的代碼:KSOAP例外的Android
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet=true;
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try
{
androidHttpTransport.call(SOAP_ACTION, envelope);
// SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
SoapObject response=(SoapObject)envelope.getResponse(); ------>getting exceptopn here
}
我收到以下錯誤:
W/System.err(994): SoapFault - faultcode: 'soap:Server' faultstring: 'System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
W/System.err(994): --- End of inner exception stack trace ---' faultactor: 'null' detail: [email protected]
W/System.err(994): at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:116)
W/System.err(994): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:137)
W/System.err(994): at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
W/System.err(994): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
W/System.err(994): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
W/System.err(994): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
W/System.err(994): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
W/System.err(994): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
W/System.err(994): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
W/System.err(994): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(994): at android.os.Looper.loop(Looper.java:123)
W/System.err(994): at android.app.ActivityThread.main(ActivityThread.java:4363)
W/System.err(994): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(994): at java.lang.reflect.Method.invoke(Method.java:521)
W/System.err(994): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
W/System.err(994): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
W/System.err(994): at dalvik.system.NativeStart.main(Native Method)
I/ActivityManager(60): Displayed activity com.redbus/.SearchRoute: 2501 ms (total 2501 ms)
任何人都可以請幫我..
如我之前說的請貼,你初始化的代碼行'request' – breceivemail
SoapObject請求=新SoapObject空間(namespace,METHOD_NAME); – subburaj
嗨Richa,我必須使用這個代碼。是否我必須使用Soapobject的情況下。 – subburaj