簡體   English   中英

wcf在android客戶端帖子上引發錯誤

[英]wcf throwing error on android client post

從android設備(evo 4g)執行客戶端發布時,我收到此消息。

-根級別的數據無效。 第1行,位置1.:1

此Web服務適用於用C#編寫的Microsoft客戶端。 這是服務合同-

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

string GetData(string username);

這是android客戶端代碼-

HttpClient 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函數。 我希望有一些建議。

造成此問題的原因是DataSet讀取操作無法讀取xml流。 我以為我可以像Microsoft客戶端DataSet在writexml操作中一樣整理xml。 Linq to xml的效果更好!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM