Walks you through the creation of a Windows Communication Foundation (WCF) service that interacts with the BookDemo base application.
In this tutorial you expose the functionality of the SqlBookWrapper program as a WCF service and use a console application
as a client to communicate with it.
Prerequisites
- Review the
Assumptions and
Before you begin sections in the
Tutorials: OpenESQL .NET Code topic to ensure that your environment is set up properly.
- Before attempting this tutorial, you must first work through
Tutorial: Prepare the SQL Server Environment.
- The features demonstrated in this tutorial require that you have installed the
Visual COBOL
WCF Tools feature. If this feature is missing, see
To install missing features from the IDE for installation instructions.
Demonstration solution - SqlBookWCF
The
SqlBookWCF solution and project you create for this tutorial uses the following provided demonstration files in addition to the BookDemo
base application:
- sqlbook.cbl
- In this tutorial, the
sqlbook.cbl program is recompiled to .NET code without any changes. Recompiling the program exposes it as a class and exposes its main
entry point as a static method. Its linkage section defines data as standard COBOL types, such as PIC X. Non-COBOL client
programs do not understand these standard COBOL types. Therefore, you must map the standard COBOL types to .NET compatible
types before communicating with the client program. This mapping is done by the
SqlBookWrapper.cbl program.
- ISqlBook.cbl
- Defines the WCF service and data contracts. Methods that define the operations in the SQLBookWrapper program are marked with
the System.ServiceModel.OperationContract() attribute. These are exposed via service endpoints. The SqlBookWrapperWCF.SqlBook
class marked with the DataContract attribute exposes the data from the SqlBookWrapper program.
- SqlBookService.cbl
- The WCF service.
- app.config
- Defines service endpoints that enable the WCF service to call SqlBookWrapper code.
Note: The solution used in this tutorial is also provided with the Visual COBOL Samples Browser in completed form. To review the
completed solution:
- Start the Visual COBOL Samples Browser. If you need instructions, see
To start the Samples Browser.
- From the drop-down menu at the top of the
Visual COBOL Samples Browser, select
Show .NET only.
- In the left pane, click
SQL.
- In the right pane, click
OESQL - WPF Book (.NET, VS).
Sequence
To complete this tutorial, progress through these topics in the order presented here. The bottom of each topic provides
Next topic and
Previous topic navigational links to help you proceed in the proper sequence: