Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3712

SQLSTATE=1H52/ SQLCODE=+462 with UPS API Tracking HTTPGETCLOBVERBOSE Request

$
0
0

I am new to REST API in RPGLE programming and after I get my POST Request fixed here POST Request, I know have a different problem with the GET for Tracking the UPS API

In the ACS Run SQL Script it works:

Select * from table(systools.httpgetclobverbose('https://wwwcie.ups.com/api/track/v1/details/xxxtrackingnumberxxx?locale=de_DE&returnSignature=false&returnMilestones=false&returnPOD=false','<httpHeader><header name="Authorization" value="Basic xxxacessTokenxxx(1308 charaters)"/><header name="transId" value="string"/><header name="transactionSrc" value="testing"/></httpHeader>'));

I have now a hard time to convert this into my RPG program.Here is the Definition and the code:

D myClob          S                   SQLType(CLOB:1000000) CCSID(1208) INZD respHeader      S                   SQLTYPE(CLOB:1000000) CCSID(1208) INZD myData          S         100000    VARYING INZD HEADER          S         100000    VARYING INZD myHeader        S           2000    VARYING INZD myUrl           S            512A   VARYING INZD accessToken     S           1500AD null            S              2B 0 INZ  C* HTTPPOST receives the accessToken hereC                   EVAL      myURL = 'https://wwwcie.ups.com/api/track/v1'C                             +'/details/xxtrackingnumberxx?locale=en_US&r'C                             +'eturnSignature=false&returnMilestones=fals'C                             +'e&returnPOD=false'C                   EVAL      myheader='<httpHeader><header name="Authoriz'C                             +'ation" value="Basic '+%TRIM(accessToken)C                             +'"/><header'C                             +' name="transId" value="string"/><header na'C                             +'me="transactionSrc" value="testing"/></htt'C                             +'pHeader>'C                   RESET                   respHeaderC                   RESET                   HEADERCC/EXEC SQLC+ SELECT  CAST(RESPONSEMSG AS CLOB(1000000)),C+         CAST(responseHttpHeader  AS CLOB(1000000))C+         INTO :myClob:null,  :respHeaderC+         FROM TABLE( SYSTOOLS.HTTPGETCLOBVerbose(C+                    CAST(:myURL AS VARCHAR(512)),C+                    CAST (:myheader AS CLOB(2K))))C/END-EXECCC                   EVAL      myData = %SUBST(myClob_data:1:myClob_len)C                   EVAL      HEADER   = %SUBST(respHeader_DATA:1:C                                                 respHeader_LEN)

myClob_data is empty as well as respHeader_DATA. Both LEN is 0.SQLCOD = +462SQLSTATE = 01H52Very hard to find a lot of Infomation about those, but I was able to find more description here:IBM Memo to Users at page 22.

• The SQL statement fails to parseor The SQL statement parameter value is a blank string or NULL

I guess I have something that is formated or define incorrectly.I also get the same result with that:

Select * into :myClob:W_NULL, :W_RSPHDR from TABLE(SYSTOOLS.HTTPGETCLOBVerbose(:myURL, :myHeader).

The RDI debugger is not working. For some reason I get a decimal error in my program by a Code that isnt mention here. So I have to use the STRDBG. But it only shows 1025 characters when I use "EVAL myheader" and as the access token is 1308 characters long, I dont know how to see the full myHeader.

And as Charles mention in my previous question to look into QSYS2.HTTP_ or HTTPAPI by Scott,I can't right now sadly. Also dont wondering about the fixed form of RPG. I have to use it, but you can answer with free RPG ofc.

The SYSTOOLS works, I just need to convert it correctly, I think..Thank you in advance.


Viewing all articles
Browse latest Browse all 3712

Trending Articles