WCF抛出错误在android客户端帖子

本文关键字:客户端 android 出错 错误 WCF | 更新日期: 2023-09-27 17:50:23

我从android设备(evo 4g)执行客户端帖子时收到此消息。

——根级数据无效。1号线,1号位置。: 1 .

这个web服务是为用c#编写的微软客户端工作的。这是服务合同——

[OperationContract (Name = " simpleGet "))[WebInvoke(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "resource/{username}", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare)]

string GetData(string username);
下面是android客户端代码——

HttpClient = new DefaultHttpClient();字符串url = "http://dev.journalr12.com/RestService.svc/resource/yegua";

           HttpPost httppost = new HttpPost(url);
       httppost.addHeader("userpass", "20,yeguacreek,date,10-1-10,none");
           String result="";
           // Execute the request
           HttpResponse response;
                String xml = entryXML.sqlXML(entryData) ;
       StringEntity se = new StringEntity(xml);
       se.setContentType("text/xml");
      se.setContentEncoding("utf8");
       httppost.setEntity(se);
               response = httpclient.execute(httppost);
               // Get hold of the response entity
               HttpEntity entity = response.getEntity();
               if (entity != null) {

                              InputStream instream = entity.getContent();
                              result= convertStreamToString(instream);
                             String a = "";
               }
                return result;
在构建了microsoft客户端并经历了可能被抛出的不同异常之后,我认为这并不适合getData函数。我想听听你的建议。

WCF抛出错误在android客户端帖子

这个问题是由于数据集读取操作无法读取xml流引起的。我认为我可以用与Microsoft客户机数据集在writexml操作中相同的方式将xml组合在一起。Linq to xml工作得更好!