【发布时间】:2011-08-07 20:23:16
【问题描述】:
我在从 android 设备 (evo 4g) 执行客户端发布时收到此消息。
--根级别的数据无效。第 1 行,位置 1.: 1
此 Web 服务适用于用 c# 编写的 Microsoft 客户端。这是服务合同--
[OperationContract(Name="simpleGet")] [WebInvoke(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "resource/{username}", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare)]
string GetData(string username);
这里是安卓客户端代码--
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 函数。我会喜欢一些建议。
【问题讨论】: