hint hint JSON in XMLSERVICE:



changes in XMLCGIX in XMLSERVICE:

// --------------
// output
when status = RUN_CGI_OUTPUT;
status = RUN_CGI_FINISH;
szOClob = strlen(pOClob);
if xFMT <> '*json';
// -----
// send header + end (LFLF)
respHead = 'Content-type: text/xml' + CRLF + CRLF + NULLTERM;
rn = writeIFS(1:%addr(respHead):strlen(%addr(respHead)));
// send return data
rn = writeIFS(1:pOClob:szOClob);

else;
// call exit program
xmlcgix2(pOClob:szOClob);
endif;

XMLCGIX2 in powerEXT:

* Standard powerEXT H-Spec's
/copy qsrc,pxapihdr General H-Spec's

* powerEXT API Connectors
/copy qsrc,pxapicgicn Basic HTTP connecter & Basic Services

d fieldName s 10a varying


* Program Entry
d PgmEntry pr extpgm('XMLCGIX2')
d *
d 10i 0

d PgmEntry pi
d pOClob *
d szOClob 10i 0

/free
clearSrvPgm();
setContent('text/html');
xmlReaderInz(pOClob:szOClob);
jsonNode('*object');
jsonNode('*boolean':'success':'true');
jsonNode('*array':'rows');
dow xmlReader = 0;
select;
when xmlGetNode = '%row';
jsonNode('*object');
when xmlGetNode = 'data' and xmlGetAttr = 'desc';
fieldName = xmlGetData;
when xmlGetNode = 'data' and xmlGetAttr = '';
if 0 <> %check('.-0123456789':xmlGetData)
or xmlGetData = '.'
or xmlGetData = '-'
or xmlGetData = '';
jsonNode('*string':fieldName:xmlGetData);
else;
jsonNode('*number':fieldName:xmlGetData);
endif;
when xmlGetNode = '/row';
jsonEndNode();
endsl;
enddo;
jsonEndNode();
jsonEndNode();
echoToClient();
return;
/end-free


On Fri, Aug 10, 2012 at 9:39 PM, Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:


On 2012-08-10, at 1:00 PM, web400-request@xxxxxxxxxxxx wrote:

The limitation you're talking about isn't actually from JT400. It's a
server-side limitation from the Remote Command host server. If you look at
the native cwb_* APIs for IBM i Access, you'll see they have the same
foibles. So, the target of disappointment/jabs/anger/whatnot should be
that server interface.

Yep - I understand that. It is just simpler to talk about it in terms of
jt400.

I like the concept of XMLSERVICE as a community-based replacement for
the Remote Command server, but wish it would have reused the PCML/XPCML
format for that part of its functionality ... although I guess that could
be added. In an ideal world, adopting the standard format would allow IBM
to update the baked-in PCML support in the RPG compiler.

Agreed. And adding these kinds of interfaces is exactly what Tony was
hoping for. As another example, JSON would be really nice - hint hint if
you are reading this (you know who you are).


Jon Paris

www.partner400.com
www.SystemiDeveloper.com




--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.