Step 5. Review required Program to use the SOAP Agent Solution

INT009B - SOAP Service - Define Agent

In this step, you will create the application program that calls the web service using your SOAP Agent solution.

There are two parts to the Agent solution:

The code example is generated as a LANSA function. You will use the RDMLX version SAMPLE_RDMLX_GETEMPLOYEES.TXT. You could write your own if appropriate.

You will use the generated code, by copying most of it to the Push Button Click event routine in the form.

Following is a brief description of the essential steps necessary for this routine to issue the web service request and receive the results.

The first thing to note is that the LANSA form communicates with the LANSA Integrator SOAP service using Built-In Functions specially designed for the purpose.

1.      The first steps are to ready the program for calling the Web Service by opening a Java Service Manager connection and loading the SOAPAgent service. The EMPLOYEEAGENT SOAP Agent solution that you have built in this exercise, is then loaded.

2.      The next step calls the GetEmployees operation of the web service. The two SET PARAMETER commands "bind" the program variables to the parameters for the operation. At this point, the user must have input these values. In your form example, the user enters the field value(s) and clicks the Get Employees button, which executes this event routine.

         The LANSA Integrator Java Services Manager has access to the variables in the LANSA program by means of the SERVICE_EXCHANGE(*FIELD) keyword. It then knows which program field to map to each parameter by means of the mappings that you specified earlier in the SOAP Wizard.

3.      In the third step, the program calls the web service operation, waits for the response and checks for a null response.

4.      The fourth step in the generated code is incomplete. Here you will add the business logic. At the moment the program loops, retrieving the RESPONSE fragment until the status (JSMXSTS) is NOFRAGMENT.

5.      Finally, the logic that will form your click event cleans up by closing the EmployeeAgent solution, unloading the SOAP Agent service and closing the connection to the JSM server.