Page 1 of 1

PUIUDFINTO Questions

Posted: Fri Jul 02, 2021 5:05 pm
by emhill
Scott,

As you know we deal with the diesel engine parts and services industry. One of their big players, Allison Diesel, has decided to completely change the way warranty claims are uploaded to them. Currently we FTP data to them and get status info in return (successful upload, rejected, etc.). They sprung this on us last week and have a deadline of August 1 to implement all the changes. It's going to be massive.

That being said I think the PUIUDFINTO might be the best route to go. I've been looking at the PUI ViewSource for PUIUDFINTO and it seems like it would work. Just a couple of questions that have me confused. I'm not proficient in web service API's and was not sure about some things. I know I can build the JSON file to send using the UDF editor. I've one this in the past but sending the POST to the URL and then the GET to return the status is where I'm lost. Would one of your HTTPAPI examples be a good one for this? Since PUIUDFINTO will be the parser I just need something that will take the URL I need and send the JSON data. I've been playing around with SOAPUI for testing using PUT, GET, and POST but need something coming from an RPG program.

Any suggestions?

Re: PUIUDFINTO Questions

Posted: Fri Jul 02, 2021 8:40 pm
by Scott Klement
Hmmm... is Allison Diesel related to Vin? Maybe his wife?

emhill> I've one this in the past but sending the POST to the URL and then the GET to return the status is where I'm lost.

I feel like there's some text missing in the above line?

Did they tell you you need to send the document with POST and then make a separate request to get the status with GET? If so, that means you'll be in the role of a web service consumer (also known as "client"). Whereas, if Allison Diesel is the one doing the POST/GET, then you would be in the role of the provider (aka "server".)

The PUIUDFINTO and Universal Display stuff is for the provider-side.

HTTPAPI is for the consumer side. If you can do it with SoapUI, then you are most likely on the consumer side.

You'll need to determine which role you're playing before determining which tool and/or examples to use. But, even if we assume you are the consumer, I couldn't tell you which example is the closest, as I know absolutely nothing about Allison Diesel's web api.

Re: PUIUDFINTO Questions

Posted: Sun Jul 04, 2021 10:04 am
by emhill
Let me see if I can clarify a bit.

I would send a POST with credentials to the URL below to submit a warranty claim. I would then be sending the claim data in JSON that I can develop in a UDF I do believe. The site would then send a response back of success or rejection. (see attached for examples of URL, data to send. and the response).

I've done something similar with UPS to get estimated shipping but it was XML. I did use the HTTPAPI open source for that but pretty much just hardcoded the XML data to send and receive (before I got familiar with UDF). Now with PUIUDFINTO I think it would make it so much better.

I'm going to revisit that UPS procedure I have to see if I can mimic it a bit using "rc=http_post" to connect and send the JSON claim data.

I may be making this harder than it needs to be. I do that sometimes. :-)

Hope you have a great 4th holiday!!!!

Re: PUIUDFINTO Questions

Posted: Sun Jul 04, 2021 10:11 am
by emhill
Scott,

I've done a little bit more research and googling and may have a little bit of a grasp on this. Let me see if I can muddle my way through it.

Thanks for the reply!!!!

Re: PUIUDFINTO Questions

Posted: Mon Jul 05, 2021 7:24 pm
by Scott Klement
You won't be able to use PUIUDFINTO, here. That is for a web services PROVIDER, not a client. It has no ability to create a document. When readding a document, it can only read from data sent via HTTP to it while it is acting as a web service provider.

For what you are describing, you can use DATA-GEN to build the document (assuming, of course, that you are reasonably up-to-date on the OS). And/or you can use the YAJL subprocedures to create it. Then, you can use HTTPAPI to communicate, and DATA-INTO and/or YAJL to interpret the document that is sent back.