Print Version Email Page Add to Favorites Comments Alert Me Add to My Links

Wednesday, June 11, 2008

Exposing SharePoint Workflow As Web Service

1. Create a New Project in Visual Studio 2005, by selecting the template: Sequential Workflow Library.

2. Add an Interface to your project (e.g. Interface1.cs)

3. Add a Method to above Interface.

The code will look like as below:

namespace WorkflowAsWebService

{

interface Interface1

{

string HelloWorld(string strName);

}

}

4. Drag and drop WebServiceInput activity.

Set the following properties

Property

Value

IsActivating

True

InterfaceType

WorkflowAsWebService.Interface1

MethodName

HelloWorld

Bind the parameter strName to a new member. For e.g.: webServiceInputActivity1_strName1

5. Drag and drop WebServiceOutput activity.

Set the following properties

Property

Value

InputActivityName

webServiceInputActivity1

Bind the parameter ReturnValue to a new member. For e.g.: webServiceOutputActivity1__ReturnValue_1

6. Write a code to handle the event webServiceInputActivity1_InputReceived

The code will look like as below:

private void webServiceInputActivity1_InputReceived(object sender, EventArgs e)

{

webServiceOutputActivity1__ReturnValue_1 = "Hello " + webServiceInputActivity1_strName1;

}

7. Right Click on the Project Name in Solution Explorer and select the option Publish as Web Service.

No comments:

World Clock