INT010 - JSON Service
The JSON Service allows a business application to call a web service operation and receive results from it without having to concern itself with any of the web service protocols and standards. The technical details have been taken care of by the LANSA Integrator JSON service and by the code generated by the JSON Wizard.
There are three exercises in this set which together, demonstrate how to implement a JSON web service using LANSA Integrator Studio. These exercises need to be completed in sequence.
These exercises create a web service using JSON types EmployeeDeptSect and Employees.
- The JSON client web service will pass a department and section to the server.
- A list of employees for that department and section will be returned as an array.
- If only a department is passed, a list of employees in all sections for that department will be returned.
- If no department and section is provided then all employees for the company will be returned.
The Business Logic (program code), provided for you in INT010C to test this service has been created as a Visual LANSA form. In LANSA it could also be written as a 5250 function, or as a web page application. You could also use RPG.
The following summarizes the steps you will take in the three exercises to build and test your JSON Service:
INT010A – JSON Service – Define Server
- Define JSON Server Types – the variables to be handled by this service
- Create a JSON Server solution and JSON Agent solution using the JSON Server Wizard.
- Map parameters to program variables for both solutions.
- Build one solution which creates jar file to handle iiiEmployeeDeptSect, which is used in both the client and the server.
- Build another solution which creates jar file to handle iiiEmployees, which is used in both the client and the server.
- Use the generated RDMLX to create a function which supports the response for employees and add your business logic
- Register the function as a JSMDIRECT service
INT010B – JSON Service – Create Client Logic
- Use the generated RDMLX from INT010A to create a function which supports the request for employees and add your business logic
- Create the form iiiFRM05 based on the generated RDMLX and add your business logic
INT010C – JSON Service – Test
- The form accepts department and section code and calls the JSON agent function which calls a service on the server which:
- Binds to iiiEMPLOYEEDEPTSECT which causes the program variables to be set
- Web Server invokes JSMDIRECT which runs the function implementing IIIEMPLOYEEJSON
- Form receives employees list and populates list view to display results.