RSS

Easy Start with WCF and Workflow Foundation (WF)

11 Mar

WCF + WF, why not?

  1. Fire up Visual Studio 2010
  2. Create new “WCF Workflow Service Application” project, called it “Development.WcfAndWf”
  3. At the very basic, you already get a WCF service that’s ready to go. This WCF Workflow Service Application is pretty much the same as regular WCF Service Application. If you open ‘web.config’ file, you will the similar tags.
  4. Notice when you run this project (Service1.xamlx), Visual Studio will run its test client as shown below. This test client is the same one you see in WCF Service Application.
  5. Another similarity to regular WCF Service Application is when you run this under your browser (open web.config and press F5). You will also be able to see the WSDL.
  6. Let’s consume this service. Create new “Console Application” project under the same solution. Call this project “Development.Client”.
  7. Now, we need to add Service Reference to our WCF Workflow Service Application. Right click on Reference folder > Add Service Reference.
  8. Click on Discover button. Leave the Namespace as is or give it a nice name.
  9. Open up Program.cs file from “Development.Client” project.
  10. Write the following code:
    namespace Development.Client
    {
        class Program
        {
            static void Main(string[] args)
            {
                var service = new ServiceReference1.ServiceClient();
                var result = service.GetData(12);
    
                Console.WriteLine(result);
                Console.ReadLine();
            }
        }
    }
    
  11. Set the project as a startup project.
  12. Run (F5). You should see the following:
Advertisements
 
1 Comment

Posted by on March 11, 2011 in General

 

Tags: , , , , ,

One response to “Easy Start with WCF and Workflow Foundation (WF)

  1. phyto sc

    September 24, 2014 at 5:37 pm

    Have you ever considered creating an e-book or guest authoring on other websites?
    I have a blog based upon on the same ideas you
    discuss and would love to have you share some stories/information. I
    know my subscribers would value your work. If you’re
    even remotely interested, feel free to shoot me an e mail.

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: