Set Up the ESREST Enterprise Server Instance

Walks you through the process of creating and configuring an enterprise server instance, ESREST, to use in this tutorial.
Restriction: This topic applies only when the Enterprise Server feature is enabled.

To successfully deploy, and run or debug, a REST Web service, you must have an enterprise server instance configured and started in Enterprise Server. For this tutorial, you create the ESREST enterprise server instance, set its listener port, and optionally configure a deployment folder for it to use.

Start the Server Explorer

The Server Explorer expandable ribbon is visible in Visual Studio on the top left side of the IDE by default when using Visual COBOL. However, if it is not visible:

  • In Visual Studio, click View > Server Explorer.

Start Enterprise Server Administration

  • On the Server Explorer, right-click Micro Focus Servers, and then click Administration.

    The Enterprise Server Administration Home page starts in a Visual Studio window.

Create ESREST

In this section, you create the ESREST enterprise server instance from the Home page in Enterprise Server Administration.

  1. From the Enterprise Server Administration Home page, click Add.
  2. In the Server Name field, type ESREST.
  3. Click Next.
  4. Under Server Type, select Micro Focus Enterprise Server; then click Next.
  5. On the Add server (Page 3 of 3) page, click Add.

Configure ESREST

By default, your new enterprise server instance is already configured for REST Web services; however, you must make some adjustments, which include enabling dynamic debugging, setting an endpoint address for the Web Services and J2EE listener, and if you do not have Administrator privileges to the Visual COBOL installation folder, defining a deployment folder.

Enable Dynamic Debugging
  1. On the Enterprise Server Administration Home page in the table of servers, click the Edit button that corresponds to the ESREST server.
  2. On the Server > Properties > General page (default), in the Startup Options group, check Allow Dynamic Debugging, and then click OK.

    This returns you to the Home page.

Configure Listeners
  1. On the Enterprise Server Administration Home page, in the Communications Processes column for the ESREST server, click the Details button.

    This takes you to the Communications Processes page for Enterprise Server listeners.

  2. Click the Edit button that corresponds to Web Services and J2EE.
  3. Change the contents of the Endpoint Address field to *:9003.
  4. Click OK.

    This returns you to the Communications Processes page.

  5. Click the Edit button that corresponds to Web listener.
  6. Change the value of the New Status field to Stopped. This enables deployment of a REST service interface.
  7. Click OK.
Important: The default deployment directory used by Enterprise Server is a subdirectory, deploy, within your Visual COBOL installation directory structure. If you have Administrator privileges to this subdirectory, or if you started Visual Studio using Run as Administrator, you are not required to complete the following tasks. Otherwise, you must complete them to create and configure an alternative deployment directory.

Create and configure a deployment directory

Create the deploy directory
Without Administrator privileges, you cannot deploy to Enterprise Server from the default Visual COBOL deployment folder. To ensure successful deployment, create a deploy subdirectory in your project.
  1. In the Solution Explorer, right-click the project, and then select Add > New Folder from the context menu.
  2. Type deploy; then press Enter.
Import the .mfdeploy file
The new deploy folder must contain the .mfdeploy configuration file. You import the file from the Solution Explorer.
  1. From the Solution Explorer, right-click the deploy folder; then select Add > Existing Item.
  2. Browse to the %ProgramFiles(x86)%\Micro Focus\Visual COBOL\deploy folder.
  3. Set the filter drop-down list to All Files (*.*).
  4. Double-click the .mfdeploy file.
Define the deployment directory
Now you need to configure your enterprise server instance by defining the new deploy project folder as the deployment folder.
  1. On the Enterprise Server Administration Home page in the Communications Processes column for your enterprise server instance, click the Details button that corresponds to Listeners.
  2. In the row for the Web listener name, click Edit.
  3. Scroll down to the Configuration Information field; then within the field, scroll down until you find the relevant code, then change:
    uploads=<ES>/deploy

    to:

    uploads=c:/tutorials/IMTK/project-name/deploy

    where project-name is the name of the project.

  4. Click OK.
  5. Click Home to return to the Home page.