我從android設備(evo 4g)執行客戶端帖子時收到此消息。wcf在Android客戶端投擲錯誤帖子
- 根級數據無效。行1,位置1 .: 1
此Web服務正在爲使用C#編寫的Microsoft客戶端工作。這裏是服務Contract--
[OperationContract的(名稱= 「simpleGet」)] [WebInvoke(ResponseFormat = WebMessageFormat.Xml,UriTemplate = 「資源/ {用戶名}」,方法= 「POST」,BodyStyle = WebMessageBodyStyle .Bare)]
string GetData(string username);
和這裏是Android客戶代碼 -
HttpClient的HttpClient的新= DefaultHttpClient(); String 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;
建立微軟客戶端,體驗不同的異常,將拋出後,我不認爲這是能夠進入的getData函數。我會喜歡一些建議。