Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
z/OS Web enablement toolkit - Rexx trigger Db2 REST API

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

Senior Member


Joined: 29 Jul 2008
Posts: 1017
Location: India

PostPosted: Thu Jan 30, 2020 11:37 am    Post subject: z/OS Web enablement toolkit - Rexx trigger Db2 REST API
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    Post subject:
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    Post subject:
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: 1017
Location: India

PostPosted: Wed Mar 04, 2020 3:34 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Rexx STRIP Equivalent function in CLIST upendrasri CLIST & REXX 5 Mon Mar 16, 2020 9:57 pm
No new posts Execute DSNTEP2 in REXX which is call... sushanth bobby CLIST & REXX 4 Wed Mar 04, 2020 3:27 pm
No new posts Need information on creating dynamic ... grvdeshmukh0 CLIST & REXX 8 Thu Jan 16, 2020 1:55 pm
No new posts Using IMS adapter for REXX dipak2805 CLIST & REXX 4 Mon Jan 06, 2020 1:24 pm
No new posts Getting sqlcode 805 while executing R... abdulrafi DB2 10 Thu Dec 26, 2019 11:46 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us