8 24 2 WEBROUTINE Examples

LANSA Technical

8.24.2 WEBROUTINE Examples

For example, a WAM can be created to all a user to search for an employee in file, select the employee from a search list and display the employee details. Three WebRoutines might be defined as follows:

FUNCTION OPTIONS(*DIRECT)
BEGIN_COM ROLE(*EXTENDS #PRIM_WAM)
 
WEBROUTINE NAME(SearchQuery)DESC('Search Criteria')
ENDROUTINE
 
WEBROUTINE NAME(Browse)DESC('Browse Employees')
ENDROUTINE
 
WEBROUTINE NAME(Details)DESC('Details') SERVICENAME(EmpDetails)
ENDROUTINE
 

WEBROUTINE NAME(Send_Sample) DESC('Sample Document') RESPONSE(#HTTPR)
ENDROUTINE

WEBROUTINE NAME(Update) DESC('JSON response') RESPONSE(*JSON)
END_COM
 

The Details WebRoutine can be invoked from the browser by providing just the Service Name keyword in the URL (without the additional keywords):

http://localhost/cgi-bin/lansaweb?srve=EmpDetails 
 

Refer to the 8.23.2 WEB_MAP Examples for example of how data could be mapped for each WebRoutine.