Writing and consuming a simple web service
In this recipe, let's create a simple web service using WCF and learn how to consume that service using a Phone 7 Client App.
Getting ready
Open the Visual Studio and create a new project from the template WCF Service and name it Recipe1_SimpleService
. Delete the default files Service1.svc
and IService1.cs
from the project.
How to do it...
For this recipe, we will be creating two projects; one is a WCF Service application and the other one is a Windows Phone client application. In the Service application, we will add the service contract and operation contract. Then, we will add a simple method to return the service information. Once the service is built, we will consume that service in the Windows Phone client application to display what is returned by the method.
Right-click on the project and add a new item using the project template WCF Service and name this file
SimpleService.svc
. The project template automatically adds theISimpleService.cs
file...