|
I had our ADMIN change the library list for the web service which cleared up the MCH3401. I am now using the yajl_writeStdout procedure but the JSON is still not being returned as a response. Below is the code using the YAJL process.
Any ideas on why the JSON is not being returned is appreciated. Thanks!
**free
ctl-opt BndDir('YAJL/YAJL': 'QC2LE') DecEdit('0.');
/include yajl/qrpglesrc,yajl_h
dcl-pr getenv pointer extproc(*dclcase);
var pointer value options(*string);
end-pr;
dcl-c UPPER const('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
dcl-c lower const('abcdefghijklmnopqrstuvwxyz');
dcl-s env pointer;
dcl-s method varchar(10);
dcl-pr SysCmd int(10) extproc('system');
*n pointer value options(*string);
end-pr;
dcl-s sysErrMsg char(7) import('_EXCP_MSGID');
dcl-s bigCharVar char(100000) inz;
dcl-s httpHeader char(500) inz;
dcl-s charVar char(500) inz;
dcl-s lengthOfJSON int(10) inz;
dcl-c CRLF const(X'0d25');
dcl-c q const(X'7D');
dcl-s httpStatus packed(3: 0) inz;
dcl-s success ind inz(*On);
dcl-s uri varchar(1000) inz;
dcl-s errMsg varchar(500) inz;
dcl-s refOrderNumber char(15) inz;
dcl-s refOrderStartPos int(10) inz;
dcl-s refOrderEnd int(10) inz;
dcl-s docNode like(yajl_val);
*InLR = *On;
Exec SQL Set Option naming=*SYS;
env = getenv('REQUEST_METHOD');
If env <> *null;
method = %xlate(lower: UPPER: %str(env));
EndIf;
env = getenv('REQUEST_URI');
If env <> *null;
uri = %Str(env);
EndIf;
refOrderStartPos = %Scan('/orders/': uri) + %len('/orders/');
refOrderNumber = %Trim(%SubSt(uri: refOrderStartPos));
yajl_genOpen(*off);
yajl_beginObj();
yajl_addBool('success': 'true');
yajl_addChar('errorMsg': 'This is a test');
yajl_beginObj('orderHeader');
yajl_addChar('refOrderNumber': refOrderNumber);
yajl_endObj();
yajl_endObj();
yajl_writeStdout(200: errMsg);
yajl_genClose();
return;
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.