[英]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.