While we generate API requester artifacts using zconbt commandline tool and the API specification file the zconbt is not generating copybooks for multiple error responses. Suppose in the API swagger file we have defined response schema for HTTP codes 200, 400, 500 where the response schema definition is different for each of these responses. Now if we generate the copybooks using zconbt the zconbt ignores the response schema for 400 and 500 and generates the response copybook structure for 200 code only. Now when we invoke this API from MF and get a response with status code 400 and response message as per defined in the swagger for 400 then zcee is not able to transform and send the message back to the MF in a proper copybook variable. This is because the response schema for 400 was already ignored by zconbt in the first place. So my question is do we have a work around to handle this type of scenario where we need to have all the error response schema available via cobol copybooks for handling the the error responses as well.
Asked
Active
Viewed 805 times
0
-
Have you asked the vendor via their support channels? – cschneid Apr 06 '20 at 15:05
-
No not yet..they have some support cases already registered for this..but do not have a proper status there – Aritra Dasgupta Apr 07 '20 at 16:31
1 Answers
1
As you have said the API Requester functionality in z/OS Connect EE only provides JSON to COBOL transformation for the success case on an API call.
If the API call completes with something other than the success case, then the response information is returned as-is in the BAQ-RESPONSE-API
structure.
Based on the example in the Knowledge Center you could process these responses as follows:
WHEN BAQ-ERROR-IN-API
EVALUATE BAQ-STATUS-CODE
WHEN 400
DISPLAY "Invalid Pet ID"
WHEN 500
DISPLAY "No pet found with ID "
WHEN OTHER
DISPLAY "API returned error "
BAQ-STATUS-CODE
END-EVALUATE
The JSON response is available in the BAQ-STATUS-MESSAGE
field and could be parsed using the JSON support in COBOL or PL/I if required.

crshnburn
- 104
- 5
-
BAQ-STATUS-MESSAGE field and could be parsed using the JSON support in COBOL or PL/I if required...can you please elaborate what is meant by JSON support in COBOL? – Aritra Dasgupta May 19 '20 at 09:38
-
I've updated the answer to include links which explain about using JSON in COBOL and PL/I, hope that is helpful. – crshnburn May 20 '20 at 10:13