Click here to Skip to main content
15,892,480 members
Articles / Programming Languages / XML

WS-Transfer Service for Workflow

Rate me:
Please Sign up or sign in to vote.
4.93/5 (16 votes)
23 Nov 2006CPOL12 min read 96K   438   62  
This article describes a design and implementation of the WF workflow connectivity to the Windows Communication Foundation (WCF) Service for WS-Transfer operation contract.
//*****************************************************************************
//    Description.....Example - Ws-Transfer driven Service
//                                
//    Author..........Roman Kiss, rkiss@pathcom.com
//    Copyright � 2005 ATZ Consulting Inc. (see included license.rtf file)        
//                        
//    Date Created:    06/06/05
//
//    Date        Modified By     Description
//-----------------------------------------------------------------------------
//    06/06/05    Roman Kiss     Initial Revision
//    01/20/06    Roman Kiss     migrating to JanCTP (Go-Live)
//    03/03/06    Roman Kiss     migrating to FebCTP 
//    07/07/06    Roman Kiss     migrating to JuneCTP 
//    11/11/06    Roman Kiss     RTM
//*****************************************************************************
//
#region References
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
//
using RKiss.WSTransfer.Adapters;
#endregion

namespace RKiss.WSTransfer.Services
{
    /// <summary>
    /// Example - Boilerplate for WS-Transfer Service
    /// </summary>
    public class xxxService : WSTransferAdapterBase<ResourceDescriptor>, IWSTransfer
    {

        #region IWSTransferFactory Members
        public CreateResponse Create(CreateRequest request)
        {
            // create descriptor
            ResourceDescriptor rd = new ResourceDescriptor();

            // todo: store the resource

            // add descriptor to the address
            EndpointAddress resourceEndpointAddress = base.ResourceEndpointAddress(null, rd);

            // done
            return new CreateResponse(resourceEndpointAddress);
        }
        #endregion
   
        #region IWSTransferOperation Members
        public GetResponse Get(GetRequest request)
        {
            // resource body
            object resource = null;

            // get resource identifier
            MessageHeaders resourceIdentifier = OperationContext.Current.IncomingMessageHeaders;

            // get descriptor
            ResourceDescriptor rd = GetResourceIdentifier(resourceIdentifier);

            // todo: get the resource

            // done
            return new GetResponse(resource);
        }

        public PutResponse Put(PutRequest request)
        {
            // resource body
            object resource = request.Resource;

            // get resource identifier
            MessageHeaders resourceIdentifier = OperationContext.Current.IncomingMessageHeaders;

            // get descriptor
            ResourceDescriptor rd = GetResourceIdentifier(resourceIdentifier);

            // todo: update resource state

            // done
            return new PutResponse();
        }

        public DeleteResponse Delete(DeleteRequest request)
        {
            // get resource identifier
            MessageHeaders resourceIdentifier = OperationContext.Current.IncomingMessageHeaders;

            // get descriptor
            ResourceDescriptor rd = GetResourceIdentifier(resourceIdentifier);

            // todo: delete resource

            // done
            return new DeleteResponse();
        }
        #endregion
    }
}

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
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions