Step 5. Review required Program to use the SOAP Agent Solution
INT010B - 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 user based visual form which implements the getEmployees SOAP Service application, from the code example supplied in Step 6. Create form iiiFRM02 - Get Employees using SOAP
- The RDMLX code generated by Integrator Studio for the EmployeeAgent 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.
- Use the generated code, by copying most of it to the event routine in the visual form.
Following is a brief description of the essential steps necessary for this click event handler 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 tutorial, 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 Service 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 which 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.