Provides instructions for adding a client project to the SqlBookWCF 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 SqlBookWrapper program through the WCF service contract,
and query the database.
- In the
Solution Explorer, right-click the solution; then select
Add > New Project.
- On the
Add a new project dialog box, select
COBOL from the
Languages drop-down list.
- Scroll down the list and select
Console Application (.NET Framework), and then click
Next.
- In the
Project field, type
SqlClientWCF, and 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
SqlClientWCF project; then select Add > Service Reference.
- In the
Add Service Reference window, click
Discover.
- In the
Namespace field, replace the default namespace with
SqlBookWCF; 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
SqlClientWCF project.
- Right-click the
SqlClientWCF 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\SqlBookDemoWCF\SqlClientWCF directory.
- Select
Program1.cbl; then click
Add.
Rebuild the solution
- In the
Solution Explorer, right-click the
SqlBookWCF solution; then select
Rebuild Solution from the context menu.