IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

z/OS Web enablement toolkit - Rexx trigger Db2 REST API


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1018
Location: India

PostPosted: Thu Jan 30, 2020 11:37 am
Reply with quote

Hi,

I am triggering a REST API implemented in Db2 using HTTP POST request to trigger stored procedure(written in rexx). And i am calling this REST API from mainframe using rexx, after going through some of the samples in below links, this works,

z/OS Web Enablement Toolkit

SYS1.SAMPLIB(HWTHXRX1)

Just for information, its a huge code, so flow of the calls in the program are in this order,
Code:

************************************************           
** HTTP Web Enablement Toolkit Sample (Begin) **           
1. HTTP_init HWTH_HANDLETYPE_CONNECTION - OK               
ConnectionUri = http://db2test.plexq1.server.rbsgrp.net   
2. HTTP_setupConnection - OK                               
3. HTTP_connect to HTTP server - OK                       
4. HTTP_init HWTH_HANDLETYPE_HTTPREQUEST - OK             
RC HWTH_OPT_REQUESTMETHOD = 0                             
RC HWTH_OPT_URI = 0                                       
RC HWTH_OPT_HTTPAUTH= 0                                   
RC HWTH_OPT_USERNAME= 0                                   
RC HWTH_OPT_PASSWORD= 0                                   
RC HWTH_SLST_NEW = 0 0                                     
RC acceptLanguageHeader = 0 0                             
RC contentTypeHeader = 0 0                                 
RC HWTH_OPT_HTTPHEADERS = 0 0                             
5. HTTP_setupRequest - OK                                 
Making Http Request                                       
Request completed                                         
6. HTTP_request - OK                                       
ResponseStatusCode = 200                                   
ExpectedResponseStatus = 200                                                   
ResponseBody = :"Output Parameters"::"result":" DSNT232I -DB2D SUCCESSFUL BIND
FOR PACKAGE = RENETDD1DB2D.CRXXD4.QTFPRDET.(QT1.1005171153)":,"StatusCode": 200
,"StatusDescription": "Execution Successful":                                 
***                                                                           


Currently HTTP authentication level for this is HWTH_HTTPAUTH_BASIC which requires a userid & password. So i am supplying my mainframe userid & password to execute this.
Other option available HWTH_HTTPAUTH_NONE, so far i have not seen any sample using this.

What we are trying to do is, a mainframe system task will be triggering this API and system tasks just has userid doesn't have any password. So looking for a way how this can be achieved.

Thanks,
Sushanth
Back to top
View user's profile Send private message
IEFBR14X

New User


Joined: 20 Feb 2020
Posts: 2
Location: Germany

PostPosted: Thu Feb 20, 2020 6:13 pm
Reply with quote

Hello Sushanth,

How did you get HWTH_OPT_HTTPAUTH working?
I use it with HWTH_HTTPAUTH_BASIC within a HTTPS Connection and get always a RC 515 (x'203').

Thanks,
Daniel
Back to top
View user's profile Send private message
IEFBR14X

New User


Joined: 20 Feb 2020
Posts: 2
Location: Germany

PostPosted: Thu Feb 20, 2020 7:14 pm
Reply with quote

Call:
Code:

HTTPauth = 'HWTH_HTTPAUTH_BASIC'       
ReturnCode = -1                       
DiagArea. = ''                         
address hwthttp "hwthset ",           
                "ReturnCode ",         
                "ConnectionHandle ",   
                "HWTH_OPT_HTTPAUTH ", 
                "HTTPauth ",           
                "DiagArea."           


this is the complete Output:
Code:

*ERROR* (hwthset) at time: 14:40:05             
Rexx RC: 0, Toolkit ReturnCode: 515             
DiagArea.Service: 0                             
DiagArea.ReasonCode: 0                         
DiagArea.ReasonDesc: Not a valid connect option.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1018
Location: India

PostPosted: Wed Mar 04, 2020 3:34 pm
Reply with quote

Hi Daniel,

Really sorry for the late reply, got occupied. The section of code which you had posted mine looks like this. The "HTTPauth" i don't think it will be considered as a variable as you have put that within double quotes.

Mine looks like this,
Code:
DiagArea. = ''                           
address hwthttp "hwthset ",               
                "ReturnCode ",           
                "RequestHandle ",         
                "HWTH_OPT_HTTPAUTH ",     
                "HWTH_HTTPAUTH_BASIC ",   
                "DiagArea."               
RexxRC = RC                               
say 'RC HWTH_OPT_HTTPAUTH= 'RexxRC       


Thanks,
Sushanth
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts rexx pgm to create multiple ps file IBM Tools 7
No new posts Mainframe batch Job or REXX to get VT... CLIST & REXX 7
No new posts calling OMEGAMON from REXX CLIST & REXX 3
No new posts REXX allocated datasets in JCL CLIST & REXX 9
No new posts getting RC=3650 when invoking REXX wi... CLIST & REXX 7
Search our Forums:

Back to Top