Selva
Selva

Reputation: 31

How to consume wcf service in xamarin.forms?

I am new for xamrin forms, now i want to access wcf service in xamarin froms`WebRequest request = WebRequest.Create(uri); request.Method = "POST"; request.ContentType = "text/plain; charset=utf-8";

            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. 

Thanks in advance..

Upvotes: 1

Views: 894

Answers (1)

FabriBertani
FabriBertani

Reputation: 1636

Official xamarin walkthrough: Walkthrough - Working with WCF

Official xamarin walkthrough to consume WFC: Consuming a Windows Communication Foundation (WCF) Web Service

Official xamarin sample from walkthrough: WCF Walkthrough Sample

Upvotes: 1

Related Questions