Consuming (calling) a WCF service in Windows store app

windows 8 start menuCalling a WCF service in a Windows store app is a bit different from the normal WPF here is a sample on how to do it images + code




  1. First lets add a reference to the WFC service in our project

Right click on reference -> add service reference

adding service

  1. Paste the URL in the address bar and press GO. the functions of the service should appear.

service reference

  1. Calling the WFC service from the Code behind.

Lets assume we name the service PROXY in the namespace from the previous step.

Here is a sample code on how to call the function GetAllPictures available in the service which returns a List<Picture> (Picture is the DataContract of the service)

LPServicesClient proxy = new LPServicesClient();
Task<List<LPProxy.Picture>> results = proxy.GetAllPicturesAsync();
List<Picture> result = results.Result;

Hope this helped you, if you have any comment please add them below, and remember it’s only logical to share

Leave a Reply