Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3)...

16
Visual COBOL Web Services Tutorials Page 1 Visual COBOL for Eclipse Tutorial This tutorial will demonstrate how a simple COBOL program can be used to generate a web service using the Visual COBOL for Eclipse 2.2 Update 2 product for Windows. This product can be downloaded from our website: http://supportline.microfocus.com, and also provides a version of the Eclipse IDE into which it will be installed. This demo requires enabling the Enterprise Server feature. Therefore, an SOA license is required for Visual COBOL for Eclipse 2.2 Update 2. 1) Start Visual COBOL for Eclipse from the Windows Start menu as Administrator and then select a workspace to use. 2) From the Eclipse menu select File > New > COBOL Project. Name the project webcall and click the Finish button.

Transcript of Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3)...

Page 1: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 1

Visual COBOL for Eclipse Tutorial

This tutorial will demonstrate how a simple COBOL program can be used to generate a web service using

the Visual COBOL for Eclipse 2.2 Update 2 product for Windows.

This product can be downloaded from our website: http://supportline.microfocus.com, and also

provides a version of the Eclipse IDE into which it will be installed.

This demo requires enabling the Enterprise Server feature. Therefore, an SOA license is required for

Visual COBOL for Eclipse 2.2 Update 2. 1) Start Visual COBOL for Eclipse from the Windows Start menu as Administrator and then select a

workspace to use.

2) From the Eclipse menu select File > New > COBOL Project.

Name the project webcall and click the Finish button.

Page 2: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 2

3) In COBOL Explorer right-click the Project name and choose Properties from the drop down menu.

Click Micro Focus > Build Configuration > COBOL.

Change Target Type from Single Executable File to All Int/Gnt Files.

Click Apply and then OK buttons.

4) In COBOL Explorer right-click the Project Name and select New > COBOL Program from the

dropdown menu.

Fill in New File Name (or accept default) and click Finish.

Page 3: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 3

5) A skeleton program will be loaded into the editor.

6) Fill in the Linkage Section and Procedure Division as shown below.

Page 4: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 4

7) In COBOL Explorer right-click on the Program Name and choose New > Other.

8) The Select a Wizard dialog will be displayed. Open Micro Focus IMTK and highlight Web Service then

click Next button.

Page 5: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 5

9) Name the Web Service Interface, choose None for mapping, and click Finish. Because we chose no

mapping, the mapping screen will be empty

Page 6: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 6

10) Right-click the Service Interface name and click New > Operation

11) Fill in the Operation name and click OK button.

Page 7: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 7

12) In COBOL Explorer open the Service Interface name and then click on the Add Operation and the

linkage section fields will be displayed.

13) Using the mouse drag each Linkage Section field to the Interface Fields side.

14) Double-click on the result field name under Interface Fields to open up its properties.

Change result from Input to Output and from Decimal to Integer

Page 8: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 8

15) Change the other fields Type from ‘Decimal’ to ‘Integer’ also but leave their Direction fields as

‘Input’ since we use these fields to supply data to the web service

16) In COBOL Explorer, right-click on the service name and select Properties

17) Press Change button for Enterprise Server name.

Page 9: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 9

18) Select ESDEMO from the list then click OK

19) After Enterprise Server name is displayed then choose the Application Files tab

Page 10: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 10

20) Choose Legacy application needs deploying radio button.

Click Add Files button on right.

21) Highlight .int and .idy files in File Explorer and click Open.

Page 11: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 11

22) After list of files is updated click OK.

23) Click on the Server Explorer tab to view available Enterprise Servers then right-click on ESDEMO and

select Start.

24) Progress will be displayed in the Console window.

Page 12: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 12

25) In Server Explorer, display the Enterprise Server Administration window by right-clicking on

localhost and selecting Open Administration Page.

26) Click on the Details button as show below.

27) Make note of the port number being used for the Web Services and J2EE Listener as shown

below. This number will be required when we run the client later. Close the Admin window.

Page 13: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 13

28) In COBOL Explorer, right-click the newsrv interface under Web Services and select Deploy.

29) The results will be displayed in the Console window.

Page 14: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 14

30) In COBOL Explorer, right-click the newsrv interface under Web Services and select Generate Client

31) Click on Current project and the Output directory will be automatically populated. Click on OK to

generate a client without using the generated WSDL.

Page 15: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 15

32) A client folder is created in the webcall project with two new COBOL programs as show below. The

programs will be automatically compiled and the resultant files will appear in the

New_Configuration.bin folder.

Page 16: Visual COBOL Web Services Tutorials · 2019-02-27 · Visual COBOL Web Services Tutorials Page 2 3) In COBOL Explorer right-click the Project name and choose Properties from the drop

Visual COBOL Web Services Tutorials

Page 16

33) To run the client program, in COBOL Explorer right-click on newsrv-app.cbl and select Run As>

COBOL Application.

34) The client will then prompt you for the Service Address. If the listener port number from step 28

above is different than the default 9003 then enter the new Service Address here. If it was set to

9003 then simply press Enter.

35) Press Enter on the Username and Password fields and then input an integer for field_1 and field_2

and press Enter. The Web Service will be called and will return the result to the client.