In this tutorial you expose the functionality of the OOSqlBookWrapper program as a WCF service and use a console application
as a client to communicate with it using SQL.
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 - OOSqlBookWCF
The
OOSqlBookWCF 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,
sqlbook.cbl is written in native OO COBOL. The program reads and writes to the SQL Server BookDemo database that contains the book records.
- ISqlBook.cbl
- Defines the WCF service and data contracts. Methods that define the operations in the OOSQLBookWrapper program are marked
with the System.ServiceModel.OperationContract() attribute. These are exposed via service endpoints. The OOSqlBookWrapperWCF.SqlBook
class marked with the DataContract attribute exposes the data returned to the OOSqlBookWrapper program.
- SqlBookService.cbl
- The WCF service.
- app.config
- Defines service endpoints that enable the WCF service to call OOSqlBookWrapper code.
- BookDemo Base Application
-
Important: The object-oriented version of the SqlLegacyBook project used in this tutorial, OOSqlLegacyBook, does not include the
book-rec.cpy copybook. Instead, it includes an alternative, .NET version of
book-rec-dotnet.cpy to define book-detail host variables. While the filename of this copybook is the same as the filename of the
book-rec-dotnet.cpy copybook included in the object-oriented version of the SqlBookWrapper project (OOSqlBookWrapper), they are different files
containing different code and each resides in the folder for the project to which it applies. These copybook files are named
the same solely to indicate that in the OO version of the BookDemo application, they are both coded in terms of a .NET project
rather than a legacy project.
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 - OO WCF 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: