Walks you through the process of defining service interface details for the ScheduleDemo application.
Restriction: This topic applies only when the Enterprise Server feature is enabled.
Restriction: This topic applies to Windows environments (local development) only.
Each service interface you create is comprised of a set of operations. In this tutorial, you create one operation for each
of the two functions provided by the application.
MakeAppt Operation
The purpose of the MakeAppt operation is to create an appointment and store it in the system.
- Create the MakeAppt Operation
-
- From the COBOL Explorer, expand
ProgramSOAP > Web Services.
- Right-click the
MakeCheckAppt Web service and select
New > Operation from the context menu.
- In the
Operation name field, type
MakeAppt.
This application contains only one program,
schedule.cbl. This program contains one entry point, SCHEDULE, from which to create the operation.
By default,
SCHEDULE appears in the
Entry point field.
- Click
OK.
- From the COBOL Explorer, expand
MakeCheckAppt.
- Double-click
MakeAppt.
In the
Interface Mapper, you now see that the entry point fields have been placed into the
Linkage Section pane on the left.
- Define Interface Fields
- The Schedule program needs several input items to create an appointment, including variable information such as the customer's
name, the identification number of the consultant with whom the appointment is to be made, the date of the proposed appointment,
and the desired time slot. You define interface fields to hold this information so that the client can send it to the application.
- Drag the following fields from the
Linkage Section pane to the
MakeAppt Operation - Interface Fields pane:
- lnk-customer-name
- lnk-consultant-id
- lnk-date
- lnk-time-slot
This creates interface field names similar to those of the entry point fields from which they were created. The difference
is that all dashes (-) are automatically replaced with underscores (_). In addition, a mapping is automatically created between
each new interface field and its corresponding entry point field.
The purpose of the
lnk_customer_name,
lnk_consultant_id,
lnk_date, and
lnk_time_slot fields are to hold data that is sent to the application for processing; therefore, they are input fields. The default mapping
direction for each of these,
Input, is correct.
Once the Schedule program receives the input information from the client, it sends back a code to indicate whether or not
the requested appointment is available. The program field that receives this code is
lnk-op-ok. Therefore, you need to create a corresponding interface field, and change its mapping direction from
Input (default) to
Output.
- Drag the
lnk-op-ok field from the
Linkage Section pane to the
MakeAppt Operation - Interface Fields pane.
- Double-click
lnk_op_ok in the
MakeAppt Operation - Interface Fields pane.
- Click
Output; then click
OK.
- Define COBOL Assignments
- Because the MakeAppt operation executes only one program function, the value required to initialize that function remains
constant. In this case, you create a COBOL Assignment field rather than an interface field, and assign it the value required
by the program to ensure the execution of the specific function.
From looking at the program source code, you know that when the value in the
lnk-operation field is
0, the program executes the
set-appt code. Therefore, you want to assign the
lnk-operation field a value of
0.
- In the
Linkage Section pane, right-click the
lnk-operation field, and select
New Assignment from the context menu.
- In the
Value field, type
0; then click
OK.
For this particular service, you want to make appointments only for one specific store. When the Schedule program executes,
it reads the value in the
lnk-id field to identify the store where the appointment is to be made. Therefore, you can provide the same store identification
number each time the service runs by assigning a constant value.
- In the
Linkage Section pane, expand the
lnk-store-info group.
- In the
Linkage Section pane, right-click the
lnk-id field, and select
New Assignment from the context menu.
- In the
Value field, type
08780; then click
OK.
- Click
File > Save to save the service interface.
- Completed MakeAppt Operation
CheckAppt Operation
The purpose of the CheckAppt operation is to look up an existing appointment and return its details.
- Create the CheckAppt Operation
-
- From the COBOL Explorer, expand
ProgramSOAP > Web Services.
- Right-click the
MakeCheckAppt Web service and select
New > Operation from the context menu.
- In the
Operation name field, type
CheckAppt.
Once again, the
Entry point list shows only the
SCHEDULE program, but this time it is already selected for you. This is because each service interface must use the same program across
all operations, and you specified the
SCHEDULE program in the MakeAppt operation you defined earlier for this same service interface.
- Click
OK.
- From the COBOL Explorer, expand
MakeCheckAppt.
- Double-click
CheckAppt.
Note: If
CheckAppt does not appear in the tree view, right-click
MakeCheckAppt; then select
Refresh from the context menu.
In the
Interface Mapper, the entry point fields once again appear in the
Linkage Section pane on the left.
- Define Interface Fields
- The CheckAppt operation uses most of the same interface fields as does the MakeAppt operation, and in addition includes an
output array in which the queried appointment appears, if found. Follow these steps:
- Drag the following fields from the
Linkage Section pane to the
CheckAppt Operation - Interface Fields pane:
- lnk-customer-name
- lnk-consultant-id
- lnk-date
- lnk-op-ok
- In the
Linkage Section pane, expand the
lnk-day group.
- Drag the
lnk-cust-id field to the
CheckAppt Operation - Interface Fields pane. The
lnk-cust-id field is an array.
Because
lnk-op-ok and
lnk-cust-id are both output fields, you need to change the direction of each from
Input to
Output.
- Double-click
lnk_op_ok in the
CheckAppt Operation - Interface Fields pane.
- Click
Output; then click
OK.
- Apply the
two
preceding steps to the
lnk_cust_id interface field.
- Define COBOL Assignments
- The CheckAppt operation needs to execute the
read-appt application code. Therefore, you need to assign the
lnk-operation field a value of
1.
- Drag the
lnk-operation field from the
Linkage Section pane to the
COBOL Assignments pane.
- In the
Value field, type
1; then click
OK.
Just as you did for the MakeAppt operation, you want to assign a constant value for the
lnk-id field so you are sure to query the same store each time.
- Drag the
lnk-id field from the
Linkage Section pane to the
COBOL Assignments pane.
- In the
Value field, type
08780; then click
OK.
- Click File > Save to save the service interface.
- The Completed CheckAppt Operation
-