|
Booth,And exactly for this reason there are such frameworks as BlueDroplet, node.RPG, rest4i, node.js, Dropwizard, Ninja Framework, Vert.x, etc...
What you want is not simple; there are reasons there are so many ancillary products :-) There is quite some plumbing involved.
For a proof of concept or just to get your hands dirty with REST services it is dead simple when using BlueDroplet. You have to do exactly nothing. Everything is done for you regarding the HTTP server.
Let's look at the web service:
- First you have to configure an HTTP server to start your program for a certain request. Configuring HTTP servers is an art in itself; the IBM manual is, let's put it mildly, challenging
- Then, when you manage to get your program started, it will possibly need one or more parameters. Depending on whether you used GET or POST you have to parse them out of environment variable QUERY_STRING or read stdin (a special file handle; you will need to delve into C library routines to use it - or go directly to Scott Klement's site <https://www.scottklement.com/rpg/ifs_ebook/ifs_ebook.html>)This is also covered by the framework (though in case of BlueDroplet it has not progressed that far yet).
- Your program has to send its output to stdout (another special file handle), where the HTTP server will transport it to the requesterJust call the right procedure. Where is the problem?
- You have to realize that data flowing in and out of the HTTP server is not EBCDIC (probably UTF-8) and the data in your program is; so you will have to know if and when automatic translations occur (also a part of the HTTP server configuration) or deal with UTF-8 directly (that is possible, these days).This is handled by the framework.
I am totally with you that on a low level there are many things to watch out for but this can all be handled by programs and procedures. Exactly like it is done in every other project using other programming languages. And that is also the reason why it is so dead simple to create a REST service using other programming language because all the difficult things are handled for you. You don't have to look out for all the pitfalls. It has been done for you. And we can do the same. There is no reason we cannot do it. We just have to start doing it.
As you see, there is quite a lot of knowledge required for an apparently simple web service.
Joep Beckeringh
Op 9-8-2018 om 19:14 schreef Booth Martin:
This has to be simpler than I am making it. I have a web page ( louie.martinvt.com ) that presents a simple page of states and cities. It is populated with a .json file located with the page.
The actual .json file is produced with an RPGLE program (using Scott's YAJL) and a regular physical file. My intention is to have an RPG web service provide that .json file and it be accepted by my web page's javascript. I have used Scott's program for that but I am missing something.
So far, all of the articles & examples I find discuss solutions requiring php, jquery, or some other ancillary product.
I have looked for a simple "Hello World" solution that goes end-to-end and had no luck.
Any examples or tutorials that are dumbed way down, so I can at least see what it is I am supposed to be doing?
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.