而在Android上使用kso​​ap2调用Web服务的SOAP错误 [英] Soap fault while calling webservice using ksoap2 on android

查看:263
本文介绍了而在Android上使用kso​​ap2调用Web服务的SOAP错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用消耗可以ksoap2.I成功调用不带任何参数的WebService在Android code一DOTNET web服务,但是当我试图用一个字符串参数我得到以下提到这个错误调用方法。

 肥皂:服务器'faultstring:System.Web.Services.Protocols.SoapException:服务器无法处理请求。 ---> System.NullReferenceException:对象不设置到对象的实例。

我加入这样的参数。

  request.addProperty(为arg0,用户名);
request.addProperty(ARG1,传);

在此行中抛出的错误

  SoapPrimitive结果=(SoapPrimitive)envelope.getResponse();


解决方案

我解决了自己。

而不是

  SoapPrimitive结果=(SoapPrimitive)envelope.getResponse();

我用

  SoapObject结果=(SoapObject)envelope.getResponse();

I am consuming a dotnet webservice on android code using ksoap2.I can successfully call the webservice without any parameters but when I tried to call method using a string parameters i am getting this error mentioned below.

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.

I am adding the parameters in this way.

request.addProperty("arg0", "username"); 
request.addProperty("arg1", "pass");

Errors thrown in this line

 SoapPrimitive result = (SoapPrimitive)envelope.getResponse();

解决方案

I solved myself.

Instead of

SoapPrimitive result = (SoapPrimitive) envelope.getResponse();

i used

SoapObject result = (SoapObject) envelope.getResponse();

这篇关于而在Android上使用kso​​ap2调用Web服务的SOAP错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆