# Workflow Application: How to use a WCF Service as a workflow application with basicHttpBinding or wsHttpBinding

**URL:** <https://discuss.workflowgen.com/t/workflow-application-how-to-use-a-wcf-service-as-a-workflow-application-with-basichttpbinding-or-wshttpbinding/470>\
**Category:** Workflow Applications\
**Created:** [January 14, 2015, 8:29am UTC](https://discuss.workflowgen.com/t/workflow-application-how-to-use-a-wcf-service-as-a-workflow-application-with-basichttpbinding-or-wshttpbinding/470 "2015-01-14T08:29:00Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [January 14, 2015, 8:29am UTC](https://discuss.workflowgen.com/t/workflow-application-how-to-use-a-wcf-service-as-a-workflow-application-with-basichttpbinding-or-wshttpbinding/470/1 "2015-01-14T08:29:00Z")

</div>

As of version 5.6.2, WorkflowGen includes the WCF Service workflow application, which allows you to declare a WCF Service client proxy .NET class method as a workflow application.

The following example provides instructions on how to create a simple WCF Service with methods used as workflow applications. You can download the [Workflow Application WCF Service Sample Pack](https://app.box.com/s/rqj39vafgnb0k2syveanvbil7lg0rrqu) for the complete sample source code.

Each supported datatype (Text, Numeric, DateTime, File) has a corresponding method. The supported .NET datatypes for each WorkflowGen process data datatype are:

- **Text:** `String`, `Char`, `Byte`, `SByte`, `Boolean`

- **Numeric:** `Int16`, `Int32`, `Int64`, `UInt16`, `UInt32`, `UInt64`, `Single`, `Decimal`, `Double`

- **DateTime:** `DateTime`

- **File:** `XmlDocument`, `XmlNode`, `XmlElement`, `WorkflowFile`

### Method

1. In Visual Studio, create a new .NET WCF Service website/application called `WorkflowAppWCFSample` under `http://localhost/wfgen/WfApps/WebServices`.

2. Add a reference to WorkflowGen.My.dll v2.3.4 or above (this is only required when you need to exchange files). This library is found in `\wfgen\bin` and will be included in the WorkflowAppWCFSample website/application’s `\bin` folder.

3. Update the Service attribute with `WorkflowAppWCFSample.Service`.

4. Update the service `name` attribute with `WorkflowAppWCFSample.Service` and the contract attribute with `WorkflowAppWCFSample.IService`.

5. Build the website in Visual Studio.

6. Create the WCF Service client proxy .NET class using the svcutil tool.

7. In Visual Studio, right-click on `Service.svc` then choose **View** in the browser. Note the URL for the WSDL, then run the `svcutil` tool in a command prompt. This tool will generate a client proxy .NET class `Service.cs` and configuration file `output.config` to be used in your WorkflowGen application as a client to call your WCF Service.

8. In Visual Studio, create a new .NET 3.5 Class Library called `WorkflowAppWCFSampleTest`.

9. Add a reference to the .NET libraries `System.Runtime.Serialization`, `System.ServiceModel` and the WorkflowGen.My v2.3.4 library (`\wfgen\bin`).

10. Add the generated client proxy .NET class `Service.cs` into the project.

11. Edit the `Service.cs` file by removing the generated namespace WorkflowGen.My.Data {…} code completely.

12. Add the `IService` interface and the rest of the code into a namespace called `WorkflowAppWCFSampleTest`.

13. Update the `ConfigurationName` of the `ServiceContractAttribute` of the IService interface with `WorkflowAppWCFSampleTest.IService"`.

14. Compile the `WorkflowAppWCFSampleTest` project and deploy the `WorkflowAppWCFSampleTest.dll` into the `\wfgen\bin` folder.

15. Configure WorkflowGen for the WCF Service client proxy:

16. Configure the WCF Service website/application:

You can now use this workflow application in your processes. You can repeat the application creation for each class method to test the other datatypes.

**Note:** WorkflowGen does not yet support method overload (two methods with the same name but different parameters). This will be supported in a future release.

### Notes

#### Authentication methods

The following authentication methods are supported:

- Basic authentication: See the [Workflow Application: How to configure a WCF Service workflow application for IIS Basic Authentication](https://discuss.workflowgen.com/t/workflow-application-how-to-configure-a-wcf-service-workflow-application-for-iis-basic-authentication/472) article.

- Windows Integrated authentication: See the [Workflow Application: How to configure a WCF Service workflow application for IIS Windows Authentication](https://discuss.workflowgen.com/t/workflow-application-how-to-configure-a-wcf-service-workflow-application-for-iis-windows-authentication/473) article.

- X.509 Certificate authentication: See the [Workflow Application: How to configure a WCF Service workflow application for Certificate Authentication](https://discuss.workflowgen.com/t/workflow-application-how-to-configure-a-wcf-service-workflow-application-for-certificate-authentication/471) article.

#### References

[http://msdn.microsoft.com/en-us/library/ff647503.aspx](http://msdn.microsoft.com/en-us/library/ff647503.aspx)

### About File parameter

You can send or receive the content of a File to or from your .NET Class Method. There are two ways to do this:

- If your method uses a `WorkflowGen.My.Data.WorkflowFile` object:

- If your method uses an `XmlDocument`, `XmlNode`, or `XmlElement` object:

In this case your method can convert the `XmlDocument`, `XmlNode`, or `XmlElement` into a `WorkflowFile` object.

You can use `WorkflowFile.IsWorkflowFile()` static method to check if the XmlDocument is a WorkflowFile.

Since the file content is stored in memory and sent over the network, you should avoid using these solutions for very large files.

---

_[View the full topic](https://discuss.workflowgen.com/t/workflow-application-how-to-use-a-wcf-service-as-a-workflow-application-with-basichttpbinding-or-wshttpbinding/470)._
