Skip to main content

Posts

Showing posts with the label REST

WCF Syndication RSS/Atom

1 Create a RESTful WCF Service  Open Visual Studio Select  File  >  New  >  Project Select  WCF Service Library  template under  Visual C# > WCF  templates Change the name to  ProductServiceLibrary  and click  OK Visual studio will add reference to System.ServiceModel, System.Runtime.Serialization and will add some files with sample code.  Delete IService1.cs and Service1.cs Add reference to System.ServiceModel.Web Add a new class called ProductService 1.1 Create the Data Contract  Open ProductService.cs file that you created. Add  using System.Runtime.Serialization; Add  using System.ServiceModel; Add  using System.ServiceModel.Web; Add  using using System.ServiceModel.Syndication; Add the following code in the ProductService.cs class      [DataContract]     public class ProductReview      {     ...

WCF REST pt 4 Client

Open WCF service host project that you created OR create one based on instructions  here . Add a new project to the current solution: Right click Solution on Solution Explorer > Add > Add New Project Select Console Application template under Visual C# > Windows templates Change the project name to ConsoleClient and click OK In Solution Explorer, under ConsoleClient project, right click References and select Add Reference...  Add reference to ProductServiceLibrary, System.ServiceModel and System.ServiceModel.Web In the Program.cs file,  add  using System.ServiceModel; ** add  using System.ServiceModel.Web; add  using ProductServiceLibrary; ** Add the following code       namespace ConsoleClient {     class Program     {         static void Main(string[] args)         {                      ...

WCF REST pt 3 site

Open WCF RESTful service host project that you created OR create one based on instructions here . Add a new website to the current solution: Right click Solution on Solution Explorer > Add > Add New Website Select WCF Service under Visual C# templates Change the folder name to ProductWCFService and click OK In Solution Explorer, right click on the ProductWCFService website and select Add  Reference...  Add reference to ProductServiceLibrary in solution In Solution Explorer, under ProductWCFService website, expand App_Code and delete two files IService.cs and Service.cs  Open App.config file, remove the code from  <System.ServiceModel> to </System.ServiceModel> inclusive.  In the service.svc file, add replace the code with the one given below:       <%@ ServiceHost Language="C#" Debug="true" Service="ProductServiceLibrary.ProductService"     Factory="System.ServiceModel.Activation.W...

WCF REST pt 2 Host

Open WCF RESTful service project that you created OR create one based on instructions  here . Add a new project to the current solution: Right click Solution on Solution Explorer > Add > Add New Project Select Console Application template under Visual C# > Windows templates Change the project name to ConsoleHost and click OK In Solution Explorer, under  ConsoleHost  project, right click  References  and select  Add Reference...   In the Reference Manager window, add reference to  System.ServiceModel ,  System.ServiceModel.Web , and  ProductServiceLibrary  solution Add  using  System.ServiceModel; Add  using  System.ServiceModel.Web; Add   using  ProductServiceLibrary; Add the following code in  Program.cs  file class Program     {         static void Main(string[] args)         {         ...

WCF REST pt 1 service

Create a RESTful WCF Service  1. Open Visual Studio, click File  >  New  >  Project   2. S elect  WCF Service Library  template under  Visual C# > WCF  templates 3. Change the name to StudentServiceLibrary  and click  OK 4. Visual studio will add reference to System.ServiceModel, System.Runtime.Serialization and will add some files with sample code.  5. Delete IService1.cs and Service1.cs 6. Add reference to System.ServiceModel.Web 7. Add a new class called StudentService Adding Data Contract  8. Open StudentService.cs file that you created and add the following code using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Web; 9. Add the following code in the StudentService.cs class namespace StudentServiceLibrary {     [ DataContract ] ...