简体   繁体   中英

Accessing a WCF Service from a PCL

I'm trying to call a WCF service from a PCL.

I've found a number of articles and posts detailing this, but they all seem to assume that a ServiceClient type object is available to the PCL. this post is an excellent example of that.

Is ServiceClient something that should be available to a PCL, or will I need to create one? I presume if I was creating one then I would been to use the Microsoft HTTP Client Libraries - are there any online resources for this?

(Note: I happen to be using MVVM Cross, but I don't believe this makes a difference to the question)

ServiceClient is something You need to generate with SLSvcUtil or add it with the " Add Web Reference " wizard , you don't mention Xamarinin in your question but I give it as granted because you do mention MVVM Cross

go to Introduction to Web Services and then go straight to Consuming SOAP Services and Consuming WCF Services sections, ignore all previous article sections, they are rest service related.

even if you are not using Xamarin,the article should steer you into the right direction

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