Receiving SOAP from Vendor

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
cweaver
Posts: 3
Joined: Fri Jan 31, 2025 7:26 pm

Receiving SOAP from Vendor

Post by cweaver »

I am very green when it comes to web services. I have been able to send and receive data by sending requests to various servers. We are setting up a process that will send route and order information to a third party. The route is processed on their system. They will then send the XML data back to us. To do that, they send to an endpoint. I set up the IWS on our IBM i. What I am struggling with is receiving and processing the request. What is the best way to do this? Is there a way for the IWS to create a file on the IFS? We have other processes that will receive a JSON file thru the IWS and we parse the data using DATA-INTO from *STDIN using YAJL as a parser. Unless I am mistaken, XML-INTO does not work with *STDIN. I know SOAP and XML are very old technology, but we do not have a choice on that. Open to suggestions. Thanks in advance.
Scott Klement
Site Admin
Posts: 872
Joined: Sun Jul 04, 2021 5:12 am

Re: Receiving SOAP from Vendor

Post by Scott Klement »

This is a very strange setup.

Normally when you use IWS, it handles the XML (or JSON). It parses it and extracts the important parts and sends them to your program as parameters. In fact, this is really the primary purpose of IWS -- to handle the JSON or XML so you don't have to do it yourself.

But you are expecting it to pass you the raw XML or JSON and you to parse them yourself? Why would you use IWS for that? Just use a regular server.

You mention being able to read stdin. But reading stdin wouldn't help you here, IWS does not pass data to stdin.

If you set up a regular HTTP server, then, yes... you could read from STDIN. You'd call the system-supplied QtmhRdStin() API to read stdin, and get your data into an RPG variable. Then you'd use that variable as input to XML-INTO.
cweaver
Posts: 3
Joined: Fri Jan 31, 2025 7:26 pm

Re: Receiving SOAP from Vendor

Post by cweaver »

Sorry, I did create just a regular HTTP server. I added the code to call QtmhRdStin, but cannot get the thing to compile. Do I need CGIDEV2 or any other additional libraries/objects? Do I need copybooks in the source or define something?

dcl-s string like(DtaVar) inz;
dcl-s rtnLen like(DtaLen) inz;
dcl-s err like(ErrorCod4) inz;

dcl-pr QtmhRdStin extproc('QtmhRdStin');
DtaVar pointer value;
DtaVarSize int(10) const;
DtaLen int(10);
ErrorCod4 char(32767) options(*varsize);
end-pr;

QtmhRdStin ( string
: %size(string)
: rtnLen
: err );
Scott Klement
Site Admin
Posts: 872
Joined: Sun Jul 04, 2021 5:12 am

Re: Receiving SOAP from Vendor

Post by Scott Klement »

What error are you receiving?
Post Reply