如何使用xamarin.forms中的wcf服务?
问题描述:
我是新的xamrin形式,现在我想要访问xamarin froms`WebRequest request = WebRequest.Create(uri)中的wcf服务; request.Method =“POST”; request.ContentType =“text/plain; charset = utf-8”;如何使用xamarin.forms中的wcf服务?
string json = JsonConvert.SerializeObject(ObjInput);
using (StreamWriter writer = new StreamWriter(request.GetRequestStream()))
{
writer.Write(json);
}
HttpWebResponse responce = (HttpWebResponse)request.GetResponse();
Stream reader = responce.GetResponseStream();
StreamReader sReader = new StreamReader(reader);
string outResult = sReader.ReadToEnd();
return outResult;` am using this code but getting error in Getresponse stream.
预先感谢..
答
官方xamarin演练:Walkthrough - Working with WCF
官方xamarin演练消耗WFC:WCF Walkthrough Sample
:从漫游 Consuming a Windows Communication Foundation (WCF) Web Service官方xamarin样品