Click here to Skip to main content
15,880,608 members
Articles / Web Development / ASP.NET

Stateful Web Services using WCF leveraging ASP.NET infrastructure with BasicHttpBinding

Rate me:
Please Sign up or sign in to vote.
4.97/5 (22 votes)
20 Jul 2010CPOL5 min read 75.2K   940   36  
This article explains how to manage state in Web Services using WCF by leveraging ASP.NET infrastructure with BasicHttpBinding.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Description;
using System.ServiceModel.Web;
using System.Text;
namespace OrderServiceContract
{
    [ServiceContract(Namespace = "OrderServiceContract", SessionMode = SessionMode.Allowed)]
    public interface IOrderService
    {

        [OperationContract]
        void StartPurchase();

        [OperationContract]
        string PlaceOrder(Item item);

        [OperationContract]
        string MakePayment(decimal amount);

        [OperationContract]
        string ShipOrder(string address);

        [OperationContract]
        void EndPurchase();

        // TODO: Add your service operations here
    }


    // Use a data contract as illustrated in the sample below to add composite types to service operations.
    [DataContract]
    public class Item
    {
        [DataMember]
        public string ItemName { get; set; }

        [DataMember]
        public decimal Price { get; set; }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Pramerica Systems Ireland
India India
CORE COMPETENCIES

 Design and Architecture for Microsoft SOA implementations using BizTalk, WCF, WF, SQL Server Integration Services & ESB Toolkit.

 Web Application design and implementation using ASP.NET MVC with jQuery & Entity Framework with LINQ for persistence layer.

 Designing and developing desktop applications using WPF, WinForms.

 SQL Server Database design & programming

EXPERIENCE SUMMARY

 Eleven years total, out of which 04 years as architect, 07 years as designer and developer in various Microsoft technologies like WinForms, ASP.NET WebForms, ASP.NET MVC, BizTalk, WCF, WF, WPF, SQL Server, LINQ, EF etc. Worked in various roles mainly architect, designer, team leader and developer.

 Hands on experience with ASP.NET web applications (both MVC and Web Forms) and desktop based applications as well as smart client applications using latest technologies harnessing .NET Framework 4.0, C# 4.0, ASP.NET 4.0, WCF, WF, WPF and LINQ.

 Hands-on working experience in Application integration, business process management and service oriented applications using BizTalk Server 2010, ESB Toolkit 2.1, WCF 4.0 services and SQL Server 2008 Integration Services.

 Thorough working knowledge of OOAD and agile / incremental development process.

 Experience in leading team of developers for on schedule project delivery with quality.

 Experience with low level programming like embedded C, C++ as well as systems programming on unix platform.
REMARKABLE PROFESSIONAL ACHIEVEMENTS

 Got Microsoft Community Contributor Award in year 2011 with MCC ID# 4034514.

 Published article in MSDN Magazine Feb 2011 edition on MDM with F#: http://msdn.microsoft.com/en-us/magazine/gg598923.aspx
http://www.codeproject.com/News/14767/Pattern-Matching-Database-Records-with-Fsharp.aspx

 Published highly popular article on BizTalk in www.dotnetcurry.com
http://www.dotnetcurry.com/ShowArticle.aspx?ID=683

 Umpteen blogs in BizTalk server forums and ESB toolkit forums.

Comments and Discussions