Create a new Empty Workflow Project.
Add a new interface class to the project which would be used by our WebServiceInput activity.
Suppose this is our interface class.
int AddNumber(int firstNumber, int secondNumber);
Now right click on the project and add a new Sequential Workflow.
Now drag and drop three activities. First WebServiceInput, Code and WebServiceOutput.
For webServiceInputActivity1 specify following properties.
As soon as method is added we'll see two new properties added over there one for each parameter specified in the interface method.
i.e. firstNumber and secondNumber.
Create two variables to bind with them and one more variable to hold the result.
public int intFirstNumber;
public int intSecondNumber;
public int total;
Specify intFirstNumber, intSecondNumber for firstNumber and secondNumber property of webServiceInputActivity1.
Finally set IsActivating as true;
Now right click code activity and select generate handlers to create a handler method and specify the following code for it
private void codeActivity1_ExecuteCode(object sender, EventArgs e)
total = intFirstNumber + intSecondNumber;
Now select webServiceOutputActivity1 and set its properties as following
InputActivityName = webServiceInputActivity1
ReturnValue = Activity=AddWebServiceWorkflow, Path=total (i.e. to total variable)
That's it now we want to publish it as workflow.
For this right click the project and Select Publish as a web servcie option.
This would create a new webservice which would be named as worklflowProjectName.worfklowMethodName_WebService.asmx.
Now we could use it just like any other web service created using ASP.NET.
WebServiceInputActivity recieves input from the client using the webservice. It can be associated with single web service method defined inside the interface. The WebServiceInputActivity can be followed by the set of activities which could be built in or custom activity. If the response has to sent back to the calling client than we need to make use of WebServiceOutputActivity. Bravi, if this helps please login to Mark As Answer. | Alert Moderator