You need to do the tutorials in this book in the order shown by the Tutorials Map.
You need Microsoft Visual Studio installed to do this session. We assume you are familiar with using Microsoft Visual Studio.
In this chapter you use a supplied C# client to call the COM object you deployed in the chapter Deploying a Service. Using Visual Studio, the chapter shows you how the client interfaces to the COM object.
You import the COM object into Visual Studio. Visual Studio generates a proxy program that invokes the COM object. A client application calls this proxy.
Make sure the cmapserv service is deployed and registered under Windows, and the executable files of the COBOL application, Book.int and (for debugging) Book.idy, are in a folder on COBDIR, as described in the chapter Deploying a Service.
After opening CMapClient.sln in Visual Studio, you import the cmapserv.dll COM object you deployed in the chapter Deploying a Service. (If this tutorial has been run previously, delete the old cmapserv.dll from Visual Studio before importing the new one).
This section shows you how the COM object is invoked from the client.
The file cmapclient.cs visible in the solution is the source code of the client application. Double-click cmapclient.cs to see the application source code.
In the supplied application, the following line invokes the COM object:
cmapserv comproxy = new comproxy();
and the following line calls the Next operation:
comproxy.Next(out fileStatus, out title out type, out author, ref stockno, out retail, out onhand, out sold, );
The client and the service both run in the folder where the client application starts, so copying the data files to this folder will enable the service to find them:
Copy bookfile.dat and bookfile.idx from Examples\Net Express IDE\Mapdemo to Examples\Net Express IDE\Mapdemo\Client\Microsoft.NET\COMClient\bin\debug.
Visual Studio created the latter folder and put the executable file of the client there. The .dat and .idx files are the data and index parts of the indexed file that was supplied with the demo, and which you added one record to at the start of the chapter Creating a Service.
To run the client:
After a few moments, the client displays the data from the requested record. It has successfully called the Web service, which has looked up the record in the file and returned the data.
Try a few more operations. Recall from the chapter Creating a Service that the file as supplied contains records 1111 and 2222, and you may have added a record yourself - number 4444 if you used the example data suggested in that chapter.
This is the end of this path through the tutorials. To continue to another tutorial, go to the topic Tutorials and Demos.
Copyright © 2006 Micro Focus (IP) Ltd. All rights reserved.