Calling REST API HTTPS endpoint in JSON format from Cobol 6.3

525 views Asked by At

I am trying to perform below EXEC CICS WEB CONVERSE command and communicate with https endpoint in JSON format from Cobol while performing which I am getting socket error. Response code as 17 and 42 respectively.

EXEC CICS WEB CONVERSE                   
          PATH(PATH-NAME)                
          PATHLENGTH(PATH-LENGTH)        
          GET                            
          QUERYSTRING(DATA-BODY)         
          QUERYSTRLEN(DATA-BODY-LENGTH)  
          TOCONTAINER('DFHJSON-JSON')    
          TOCHANNEL(CHANNEL-NAME)        
          MEDIATYPE(CONTENT-TYPE)        
          STATUSCODE(HTTPS-RESP)         
          STATUSTEXT(HTTPS-STAT)         
          STATUSLEN(HTTPS-STAT-LEN)      
          SESSTOKEN(TOKEN)               
          CHARACTERSET('UTF-8')          
          RESP(CICS-RESP)                
          RESP2(CICS-RESP2)              
          END-EXEC                       

Could you please help me in resolving this issue?

If you know any reference also do let me know.

I am expecting to execute this command and receive response from the api https endpoint

1

There are 1 answers

1
Leigh Compton On

These error codes -- RESP=17, RESP2=42 -- indicate a socket error. You didn't show the WEB OPEN command, but I'm guessing from your field names that you are trying to connect to the server using HTTPS. Did you receive a normal response to the WEB OPEN command? The first thing I would check is to see if your CICS region can support HTTPS. The region must have been initialized with a keyring containing at least one certificate. If the keyring was not specified at intialization, then your application can only use HTTP and not HTTPS.

There is a sample CICS WEB client program in chapter 11 of Redbook SG24-8161 which can be downloaded from https://www.redbooks.ibm.com/abstracts/sg248161.html. You may find it helpful.