简体   繁体   中英

How can I consume wcf service for login in Native apps with Portable class library (PCL) in xamarin studio

How can I consume wcf service for login in Native apps with Portable class library (PCL) in xamarin studio.

I have already created WCF Services for Login and hosted on IIS.

Now i want use this wcf service in xamarin studio Native application with Portable Class Library (PCL) for login, change password and forget password.

I have created Android, ios and Window Phone 8.0 Project in visual studio solution.

I have make so much RND on this but I couldn't find any proper way.

HttpClient client = new HttpClient();

// A POST request needs HttpContent along with the webservice URI
string body = "YOUR REQUEST BODY HERE"; // username/password in JSON format
var content = new StringContent(body);

client.PostAsync("YOUR_SERVICE_URL", content);

If your webservice needs some headers, use:

client.DefaultRequestHeaders.Add("key","value");

You can also send the username/password as headers.

NOTE: You might need to add Microsoft.net.Http package from nuget

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM