This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
-
Dino
- Posts: 438
- Joined: Fri Jul 19, 2019 7:49 am
- Location: Robbinsville, NC
-
Contact:
Post
by Dino » Sat Nov 30, 2024 4:59 pm
This worked well to find/confirm the public ip in use by the as400:
Code: Select all
Define_Com Class(#XPRIM_HttpRequest) Name(#HttpRequest)
#HttpRequest.DoGet Url('https://ipinfo.io/what-is-my-ip')
#HttpRequest.Response.AsFile Path('/tmp/whatismyip.txt') Result(#IO$STS)
Then check the content of that file.
It can also be used to quickly access data from a web page from the as400.
If you display the result and just see garbled data, try changing the ccsid of the resultant file to 1252
-
adale
- Posts: 162
- Joined: Wed Apr 08, 2020 9:18 pm
- Location: Poplarville, MS
Post
by adale » Tue Dec 03, 2024 11:20 pm
Dino,
Working with the XPRIM_HttpRequest.Response, I find in my simple tests, that once you perform an action on the response (#HttpRequest.Response.AsFile, or #HttpRequest.Response.AsJson, etc.) that the response data is no longer available for further processing.
I first left it with the .AsFile to save the data in the IFS as a file, but also wanted to read the json data to just pull out the IP address info using the .AsJson intrinsics to send back to the initiating dialog in my case.
I can get the response as either .AsFile, or .AsJson, but not both in the same routine run.
Is this correct? Or, is there another step I need in order to preserve the response data for further processing?
Arlyn Dale
Servias LLC