Bradley,

I tried your code and it works really good. Now we can save in the IFS the
INBOUND JSON and log it in a file in the IFS.
Thank you to everyone who participated in this discussion.
I am glad that Scott Klement just added it to his YAJLR4 program in the
YAJL_STDIN_LOAD_TREE

Gerry

On Sun, Jul 28, 2019 at 2:11 PM Roberto De Pedrini <roberto.faq400@xxxxxxxxx>
wrote:

I'm with Bradley, if you save original inbound JSON to your web service you
could use it to re-run a call to it or as a log.
I asked IBM lab to have the inbound JSON as metadata in some kind of
environment variables when I deploy my post-rest web services with IWS but
they didn't consider it so important.
Does anybody need to see inbound json in RPG/Cobol for web service logging?

Roberto De Pedrini
Faq400 - Italy


Il giorno mer 24 lug 2019 alle ore 01:03 B Stone <bvstone@xxxxxxxxx> ha
scritto:

It comes in VERY hand for debugging and logging what data actually came
in. I've used in at many clients and shared the new procedure with the
OP.

I didn't want to change anything in your code, and wanted to make is so
if
I install a newer version all I do is take mine and leave it at the
bottom.

So that's why I made it separate with the optional stream file parm so if
debug for the application is on, I supply the file name. If not, I don't
and it isn't created. If you add the option I'd use that instead of
mine.
Overwriting would be my choice. I always use unique IDs in production
for
debugging/trace file names so overwriting isn't an issue. That's just
me,
though.

I think in all it was an addition of maybe 6 lines of code.

I remember asking the OPs same question a few years ago and people
questioned why I would want that. If you can't see the data coming in,
how
do you know if it was correct. Right? Or what if it's required to
log/store the data (as it is for a couple of my clients)?

It's a simple update that adds a lot of functionality.

Bradley V. Stone
www.bvstools.com
Need to interface with Braintree with your IBM i? Contact me
<https://www.bvstools.com/contact.html> for more information!

On Tue, Jul 23, 2019 at 5:17 PM Scott Klement <
midrange-l@xxxxxxxxxxxxxxxx

wrote:

Bradley,

I assume this would only be desirable if reading input from stdin?
After all, in other cases, you already have the JSON data in your
program.

It'd be easy enough to add this into YAJL, though I'd add it as an
optional parameter rather than create a new subprocedure.

What should happen if the file already exists? Replace it or append to
it? The former would be better if you plan to process it later as a
json document, but the latter would be better if this is just intended
as a "log" (informational) type file and you don't plan to ever use it
directly.

-SK


On 7/23/2019 9:57 AM, B Stone wrote:
Nope, yajl_saveBuf saves generated JSON. Unless it's been updated to
do
otherwise.

What I did to save json as create a new function based
on yajl_stdin_load_tree() called yajl_stdin_loadandsave_tree() that
does
the same, but has the option (if a filename is passed in) to save the
JSON
read from Standard Input to the IFS.

Pretty simple to do. Scott has a lot of good IFS examples already in
the
source you can use.

Or, if you ask nice, he may add something like that to the current
version. :) I know I've needed it. And it may already be there!

Bradley V. Stone
www.bvstools.com
MAILTOOL Benefit #13 <https://www.bvstools.com/mailtool.html>: The
ability
to use an IFS stream file as the body of the email (either text or
html).

On Tue, Jul 23, 2019 at 9:52 AM Robert Rogerson <
rogersonra@xxxxxxxxx>
wrote:

Hi Diogenes, I think you're looking for

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* yajl_saveBuf(): Copy YAJL generator buffer to IFS
*
* stmf = (input) path to stream file in IFS to save to
* errMsg = (output) error that occcured (if any)
*
* returns the YAJL generator status.

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Rob

On Tue, Jul 23, 2019 at 10:21 AM Diogenes Lora <
gerrylora19@xxxxxxxxx

wrote:

We are working with Web Services on the iSeries and JSON code is
sent
INBOUND, our Web Service program parses the JSON and we do some
things
with it.

We would like to save the JSON that is coming in to the IFS(as it
is
received). This is using the POST method.

Any ideas how to get it done using Scott’s YAJL ?



Thank you,



Gerry
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


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.