Click here to Skip to main content
13,510,033 members
Click here to Skip to main content
Add your own
alternative version


46 bookmarked
Posted 24 Apr 2008

Integrating WCF Services

, 24 Apr 2008
Rate this:
Please Sign up or sign in to vote.
This article describes how WCF services can be loaded on-the-fly (without prior knowledge of the services’ contracts), setting its parameters and sequencing their invocation.


The basic concept that this article is trying to present is how to subscribe to WCF services on-the-fly without prior knowledge of the services’ contract definitions. Once these services are loaded, the user could then select the desired operations from these services to be invoked sequentially through a simple sequencer. User could also set value for any parameters of a certain operation. With such a concept, services located independently at different locations could be integrated to form a larger scale solution.

Please note that this article is just trying to illustrate a basic possibility of working with WCF services. Many more advanced possibilities are omitted from the article and are suggested in the Todo section below.


The sample project made references to the following great works:

Dynamic Programming with WCF by Vipul Modi

A General Fast Method Invoker by Luyan

Using the Code

The concept is really pretty simple. There are services hosted somewhere ready to be subscribed. These are just ordinary WCF services. The client application can load these services by requiring the user to key in the desired service’s URL. For the sample project, a service called ExampleService is hosted at the following URL:

public class ExampleService : IWorkWithIntrinsic
    #region IWorkWithIntrinsic Members

    public void WorkWithIntegers(int first, int second)
        Console.WriteLine("IWorkWithIntrinsic.WorkWithIntegers was called.");
        Console.WriteLine("\t1st Integer: " + first);
        Console.WriteLine("\t2nd Integer: " + second);

    public string WorkWithString(string myString)
        Console.WriteLine("IWorkWithIntrinsic.WorkWithString was called.");
        Console.WriteLine("\tString: " + myString);
        return myString + " returned from server.";

    public double WorkWithDouble(double myDouble)
        Console.WriteLine("IWorkWithIntrinsic.WorkWithDouble was called.");
        Console.WriteLine("\tDouble: " + myDouble);
        return myDouble + 1.0;


The user could load (subscribe) a service by going for File, Load Service. The following dialog box will greet the user. The user should check the Load All Contracts check box and click Ok.


All loaded services (proxies) will appear in a tree view. The user can then choose the desired operations to be added to the sequencer by performing a right click on the operation node and choose Add Operation. This is shown in the following diagram:


Finally, the user can click on the Play button to execute all the selected operations.


The following screen shot depicts the sequence of events that have taken place on the server side.


Brief Description of Each Project in the Solution

  • Integrator.Framework.DynamicProxyModel – A project that made dynamic proxy creation possible. Almost everything here is taken from the great works by Vipul Modi as described above.
  • Integrator.Framework.ServiceManagerModel – A project that manages all loaded proxies and its operations and parameters.
  • Integrator.Framework.Sequencer – Consists of the sequencer component.
  • Integrator.Framework.TestServer – Service Host Application
  • Integrator.UI.Shell – CAB Shell that hosts all UI components.
  • Integrator.UI.Sequencer – UI that hosts the sequencer.
  • Integrator.UI.LoadedServices – UI that hosts all loaded proxies.
  • Integrator.UI.ParameterEditor – UI that hosts the parameter editor.
  • Integrator.UI.Common – Consists of constants and event arguments for all UI components.

Running the Sample Projects

Set Integrator.Framework.TestServer as active project and execute it by pressing Alt-F5 from Visual Studio 2005.

Set Integrator.UI.Shell as active project and execute the project by pressing F5 from Visual Studio 2005. Perform the steps as described in Description on Basic Concept section above.


The following items are planned features for the project that I can't find time to get implemented.

Event Broker System – to work with the sequencer in order to construct a Publish\Subscribe model. The idea is, once an operation is completed, its return parameter can be used as input parameter to another operation.

Handling complex parameters - Currently, code to handle complex parameter has been included, but is only half-baked.

Serving UI - Having the service to serve its own UI (possibly XAML).


  • 25th April, 2008: Initial post


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


About the Author

Ben Liew
Software Developer (Senior)
Singapore Singapore
Yes, I design. Then, I code. Next, I refactor.

You may also be interested in...


Comments and Discussions

GeneralSupport for .NET 3.5 and ISB Pin
Christian Weyer25-Apr-08 4:29
memberChristian Weyer25-Apr-08 4:29 
GeneralRe: Support for .NET 3.5 and ISB Pin
taufufah26-Apr-08 5:03
membertaufufah26-Apr-08 5:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180417.1 | Last Updated 25 Apr 2008
Article Copyright 2008 by Ben Liew
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid