Provides instructions for adding a client project to the OOSqlBookWCF solution.
Create a client project
In the real world, you use various client applications to access services via their endpoints. As part of this tutorial,
you create a simple.NET COBOL console client application to access the OOSqlBookWrapper program through the WCF service contract,
and query the database.
- In the
Solution Explorer, right-click the solution; then select
Add > New Project.
- In the left pane, expand
Installed > COBOL; then click
Windows Desktop.
- In the center pane, select
Console Application.
- In the
Name field, type
OOSqlClientWCF; then click
OK.
Add a service reference
Visual Studio provides an easy way to use a WCF service in a client application. The Add Service Reference functionality
adds the service to the client project and generates a proxy for the client to use.
- In the
Solution Explorer, right-click the
OOSqlClientWCF project; then select
Add > Service Reference.
- In the
Add Service Reference window, click
Discover.
- In the
Namespace field, replace the default namespace with
OOSqlBookWCF; then click
OK.
Edit the client application
You need to program your WCF client so that it uses the exposed operations of your WCF service. In this tutorial, the client
passes the stock number as it invokes the
Read() operation, and then displays the returned data.
- In the
Solution Explorer, delete the
Program1.cbl template file in the
OOSqlClientWCF project.
- Right-click the
OOSqlClientWCF project; then select
Add > Existing Item.
- On the
Add Existing Item dialog box, select
All Files (*.*) from the
Filename filter drop-down list.
- Browse to the
%PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples\SQL\ado.net\OOSqlBookDemoWCF\OOSqlClientWCF directory.
- Select
Program1.cbl; then click
Add.
Rebuild the solution
- In the
Solution Explorer, right-click the
OOSqlBookWCF solution; then select
Rebuild Solution from the context menu.