This function is used to dynamically set the named pool used by a web service (SOAP or REST) generated with Adelia.
Context
Java client (Web service).
Parameters
ALPHA(n) |
PoolName |
Name of named pool. |
BOOL |
ReturnCode |
Operation return code: *TRUE if the operation was carried out correctly. *FALSE if not. |
Notes:
This function must be called in the program's INIT_PGM block. First specify that the INIT_PGM block is not an operation/resource of the service using the following declaration:
WS_CONFIGURE *SERVICE '_init_pgm_as_method' 'false'
The INIT_PGM block is executed on service instantiation.
As the default scope of a service is 'Request' type, this block is called on each call.
For an 'Application'-scope service, the INIT_PGM block is executed once the first time the service is used.
For example
[DECL_PGM]
BOOL rc
ALPHA(256) queryString
ALPHA(128) countryName
ALPHA(128) poolName
WS_CONFIGURE *SERVICE '_init_pgm_as_method' 'false'
[INIT_PGM]
CALL_CLASS 'VaToolBx' 'VaToolBxAwsGetQueryString' queryString rc
if rc = *TRUE
* Retrieves the value of the 'country' parameter
PROCESS_PROC getQueryParamValue 'country' countryName
if countryName <> *BLANK
poolName = 'pool' /// countryName
CALL_DLL 'VaToolBx' 'VaToolBxWSSetSpecificPoolName' poolName rc
end
end
If the VaToolBxWSSetSpecificPoolName function is successful, the service will use the named pool located using the 'country' parameter passed on the HTTP request to obtain a middleware session.