One more thing, when sending XML, if you're writing directly to the
standard-output device, you may need to convert the text from EBCDIC to ASCII
yourself.
Again, iSockets can help you with that. www.iSockets.net


-Bob Cozzi
www.iSeriesTV.com
iPod your industry news instead of reading it.
Coming July 18, 2006
Ask your friends to tune into iSeriesTV.com


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf
Of Bob Cozzi
Sent: Tuesday, June 20, 2006 6:49 PM
To: 'Web Enabling the AS400 / iSeries'
Subject: Re: [WEB400] Ajax via RSP/CGIDEV2

Even though you apparently don't read my articles (which are free) or use my RPG
xTools (which is cheap) or use iSockets (which is free) I'll give you an example
JavaScript for responseXML. 
Go to:
http://www.rpgiv.com/showascii/e2c.html

Use the View | Source menu option in your browser and look for the
"parseResponse" function.

Hope this helps.

-Bob Cozzi
www.iSeriesTV.com
iPod your industry news instead of reading it.
Coming July 18, 2006
Ask your friends to tune into iSeriesTV.com


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf
Of Bruce Guetzkow
Sent: Tuesday, June 20, 2006 4:42 PM
To: web400@xxxxxxxxxxxx
Subject: Re: [WEB400] Ajax via RSP/CGIDEV2

Scott:

<snip>
I'd start by sniffing the connection to see what (if anything) the browser
is receiving from the HTTP server.


If you're receiving valid data, you know that the problem is on the
browserside (likely the JavaScript code) and if you're not, you know that
the problem is on the server (CGI) side. 


Personally, I prefer to test the server side independently, make sure it
works exactly as you expect, then write the AJAX code to use it. It just
makes it easier to track down problems. 
</snip>

I can use debug to see the XML being created.  CGIDEV2 allocates memory and
puts the document into a field based on a pointer.  I can look at the field
and see the entire XML document in there prior to CGIDEV2's
WrtSection('*fini') statement.  In fact, if I continue with debug I continue
to see the XML in the field right up to the point of the call to QtmhWrStout
(no errors returned by the API).

I have also tested a very simple program, skipping the CGIDEV2 calls and
sending the XML document directly from the top-level program and _finally_ I
was able to get the XML document to be returned to responseText.  That tells
me that I'm not setting the content type correctly, but I'm at a loss.  It
also makes me wonder where CGIDEV2 is really sending the XML.

I have tested the lower level procedures outside of the Ajax call and
everything works fine there.  I think at least part of my problem is
properly specifying the content type.  I've found plenty of PHP examples for
the server-side code and Aaron Bartell recently had an article in iSeries
News about generating responseText, but I'm looking to use responseXML.

Here is an example of the XML document that I am trying to return:
        <?xml version="1.0" ?>
        <RPName>
          <rjresp>999</rjresp>
          <rjprof>99</rjprof>
          <rjprim>Y</rjprim>
          <rjsnam>SMITH, JOHN A</rjsnam>
          <rjfnam>JOHN A SMITH</rjfnam>
        </RPName>

If I'm doing something wrong here, I'm not seeing it.  Anything else you can
add is greatly appreciated.

--Bruce Guetzkow



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.