Vern
lets try to do it again with HTTPAPI/powerEXT:
http://code.google.com/p/powerext
/copy qsrc,pxapihdr General H-Spec's
* powerEXT API Connectors
/copy qsrc,pxapicgicn Basic HTTP connecter & Productivity Services
* Include LIBHTTP /copy's here
* and add HTTPAPI in h'specs bnddir
*copy qrpglesrc,httpapi_h
* Declare Internal Variables
d i s 10i 0
d io s 10i 0
d xml s 1000a varying
d xmlout s 42a varying
d xmlmax s 10i 0 inz(42)
/free
// load the incomming xml string from HTTPAPI .....
xml = '<!-- This is a test of converting string xml elements -->'
+ '<head id="12345">'
+ '<name>dsfgdfg dg</name>'
+ '<currency id="USD" />'
+ '<xno></xno>'
+ '</head>';
// Clear Service Program & Responce Object
clearSrvPgm();
setContent('*none');
// Build Responce Object
for i = 1 to %len(xml);
select;
when i = 1;
xmlout += %subst(xml:i:1);
io += 1;
when %subst(xml:i:1) = '<'
and %subst(xml:(i-1):1) = '>'
or io = xmlmax
and xmlout > '';
// add CRLF and output the xml element to the Responce Object
echo(xmlout);
xmlout = '';
io = 0;
xmlout += %subst(xml:i:1);
io += 1;
other;
xmlout += %subst(xml:i:1);
io += 1;
endsl;
endfor;
if xmlout > '';
// add CRLF and output the xml element to the Responce Object
echo(xmlout);
endif;
// Write Responce Object To Disk
echoToStmf('/powerEXTtest.xml':1208);
// or if a browser has triggered the webservice
echoToClient();
// did you really se what happend here, a browser cannot make
// ajax call's outside the domain, but by changing the roles
// and combining HTTPAPI and powerEXT a browser can call back
// into its domain and let HTTPAPI make the AJAX call outside
// its domain and get the answer back from inside the domain!
*inlr = *on;
/end-free
As an Amazon Associate we earn from qualifying purchases.