× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Yes, Booth. This is the part that writes the headers:

CharVar = 'Status: ' + %char(httpStatus) + CRLF
+ 'Content-type: text/plain' + CRLF
+ CRLF;
QtmhWrStout( charVar : %len(charVar): err );

Headers in a CGI program (which really all this is) are written out
followed by 2 CRLFs to show the end of the headers. All data (JSON, XML,
HTML, etc) follows that.

The QtmhWrStout is the API that writes to Standard Output. I believe your
program should already be doing this for your JSON data. This is a part
that is normally made easier by toolkits like CGIDEV2 and the eRPG SDK.
Also things like reading input, parsing data, etc are done behind the
scenes in a much easier fashion that using the APIs. But, I still think
it's a good idea to have a high level understanding of what is going on in
the background.

This may be a good 2-6 bucks to spend to learn the basics of CGI
programming.
https://www.amazon.com/gp/offer-listing/1583470085/ref=tmm_pap_used_olp_sr?ie=UTF8&condition=used&qid=&sr=

You can ignore the chapters on HTTP server setup since it's based on the
old CERN web server. But the rest should still be very pertinent. I hear
it's a good read. :)

Bradley V. Stone
www.bvstools.com
MAILTOOL Benefit #9 <https://www.bvstools.com/mailtool.html>: Superior
debugging (when using MAILTOOL Plus) - Bypassing the IBM SMTP server means
that we can fully debug and track down sometimes hard to find problems.
Even the Trace TCP/IP Application (TRCTCPAPP) command won't be this
detailed!

On Sat, Sep 29, 2018 at 9:03 PM Booth Martin <booth@xxxxxxxxxxxx> wrote:

OK. I wrote my program using JSONWEBSRV from your tutorial as the
model. Is that the program that writes headers, then a blank line, then
the data?


On 9/28/2018 2:57 PM, Scott Klement wrote:
A2: When you write programs like this (called via the CGI interface
from Apache) you must write headers, then an empty line, then the
data. This error means that it never found the blank line that ends
the headers. Most common reasons are (a) its not getting written at
all, (b) you've forgotten to include the headers (c) you've forgotten
to include the blank line that tells it about the end of the headers
or (d) you're writing in the wrong character set so it doesn't
understand it.

-SK

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://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.