首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >KSOAP故障异常

KSOAP故障异常
EN

Stack Overflow用户
提问于 2012-05-16 04:27:37
回答 1查看 1.2K关注 0票数 0

我在我的application.In中使用SOAP服务来接收错误消息。

代码语言:javascript
复制
 SoapFault - faultcode: 'soap:Client' faultstring: 'System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (1, 301). ---> System.InvalidOperationException: The specified type was not recognized: name='authentication',

我的SOAP请求结构是:

代码语言:javascript
复制
 <authentication>
    <LoginID>string</LoginID>
    <Password>string</Password>
  </authentication>
  <Id>int</Id>
  <Str>string</Str>   

我的代码是:

代码语言:javascript
复制
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

                PropertyInfo usrid =new PropertyInfo();
            usrid.setName("LoginID");
            usrid.setValue(userid);
            usrid.setType(String.class);
            request.addProperty(usrid);        

//          
            PropertyInfo pass =new PropertyInfo();
            pass.setName("Password");
            pass.setValue(password);
            pass.setType(String.class);
            request.addProperty(pass);

                PropertyInfo rote =new PropertyInfo();
            rote.setName("Id");
            rote.setValue(4114616);
            rote.setType(int.class);
            request.addProperty(rote);
//          
            PropertyInfo dte =new PropertyInfo();
            dte.setName("Str");
            dte.setValue(date);
            dte.setType(String.class);
            request.addProperty(dte);



 androidHttpTransport.call(SOAP_ACTION,envelope);              
//              SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
                System.out.println("subbu");
                Object response=(Object)envelope.getResponse();---->I think i am getting error here.

谁能帮帮我做错了什么吗?

EN

回答 1

Stack Overflow用户

发布于 2012-05-16 04:40:44

请查看以下链接:

  • http://code.google.com/p/ksoap2-android/wiki/CodingTipsAndTricks
  • http://seesharpgears.blogspot.com/2010/10/ksoap-android-web-service-tutorial-with.html

authentication是一个复杂的对象,但是您已经在一行中添加了所有属性。试着做这样的事情:

代码语言:javascript
复制
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

SoapObject authenticate = new SoapObject(NAMESPACE, "authenticate");
authenticate.addProperty("LoginID", "login");
authenticate.addProperty("Password", "password");

request.addSoapObject(authenticate);
request.addProperty("Id", "123");
request.addProperty("Str", "string");
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10611989

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档