HTTP Authentication help
Posted: Sat Sep 10, 2022 4:39 pm
Hi all. I don't have many experience with http post.
Can someone please help ?
Here the execution with CURL and it work fine.
curl -X 'PUT' \
'https://xx-xxxx.xxx-xxxxxx.it/xxxxxxx/1 ... xxxxxxxxxx' \
-H 'accept: */*' \
-H 'Authorization: Basic omissisvaWxzOkhmOMISSISOMISSIS==' \
-H 'Content-Type: application/json' \
-d '{omissis}'
Here my rpg call:
.
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('HTTPAPI')
D/copy qrpglesrc,httpapi_h
D incoming PR 10I 0
D descriptor 10I 0 value
D data 8192A options(*varsize)
D datalen 10I 0 value
D rc s 10I 0
D msg s 52A
D data S 2048A
*
D retdata S 32766A
D retlen S 10I 0
D nextpos S 10I 0 inz(1)
.
.
http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(add_headers) );
rc = http_url_post_raw('https://xx-xxxx.xxx-xxxxxx.it/'+
'xxxxxxx/1.1.0/xxxxxxxxxxxxx'
: %addr(data)
: %len(%trimr(data))
: 1
: %paddr('INCOMING')
: 30
: HTTP_USERAGENT
: 'application/json');
RET_VALUE = http_error; that contain "This page requires a user-id & password"
http_xproc(HTTP_POINT_ADDL_HEADER: *null);
.
.
.
i Think the problem is here.
.
P add_headers B
D PI
D headers 32767a varying
D CRLF C x'0d25'
D token s 1024a varying
/free
// code to calculate 'token' should go here.
token = 'omissis==';
headers = 'Authorization: Basic' + token + CRLF;
/end-free
P E
Can someone please help ?
Here the execution with CURL and it work fine.
curl -X 'PUT' \
'https://xx-xxxx.xxx-xxxxxx.it/xxxxxxx/1 ... xxxxxxxxxx' \
-H 'accept: */*' \
-H 'Authorization: Basic omissisvaWxzOkhmOMISSISOMISSIS==' \
-H 'Content-Type: application/json' \
-d '{omissis}'
Here my rpg call:
.
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('HTTPAPI')
D/copy qrpglesrc,httpapi_h
D incoming PR 10I 0
D descriptor 10I 0 value
D data 8192A options(*varsize)
D datalen 10I 0 value
D rc s 10I 0
D msg s 52A
D data S 2048A
*
D retdata S 32766A
D retlen S 10I 0
D nextpos S 10I 0 inz(1)
.
.
http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(add_headers) );
rc = http_url_post_raw('https://xx-xxxx.xxx-xxxxxx.it/'+
'xxxxxxx/1.1.0/xxxxxxxxxxxxx'
: %addr(data)
: %len(%trimr(data))
: 1
: %paddr('INCOMING')
: 30
: HTTP_USERAGENT
: 'application/json');
RET_VALUE = http_error; that contain "This page requires a user-id & password"
http_xproc(HTTP_POINT_ADDL_HEADER: *null);
.
.
.
i Think the problem is here.
.
P add_headers B
D PI
D headers 32767a varying
D CRLF C x'0d25'
D token s 1024a varying
/free
// code to calculate 'token' should go here.
token = 'omissis==';
headers = 'Authorization: Basic' + token + CRLF;
/end-free
P E