Sending XML file to Web Service

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

Sending XML file to Web Service

Post by cweaver »

I am attempting to send an XML file from our IFS to Illinois DOR using http_req.

It appears that it is attempting to chunk the XML file as I get an error 400 Bad Request. The Error says it is unable to locate Submission ID which is most definitely in the XML file. Their services matches the passed Submission id (P$SubmissionID) to SubmissionID tag in the XML File.

Chunk of my RPG...

URL = 'https://mytax.illinois.gov/WebServicesIn/+
TobaccoUniformity/submit/TOB/1/?submission-id=' +
%trim(P$SubmissionID) + '&test-only=true';

XMLFileLength = %len(p$XMLFile);

http_xproc(http_point_addl_header:
%paddr(AddHeader));

rc = http_req('POST'
: URL
: '/IDOR/test.html'
: *Omit
: p$XMLFile
: *Omit);

If rc <> 1;
http_crash();
return;
Endif;


What am I missing?
stefan@tageson.se
Posts: 23
Joined: Wed Jul 28, 2021 7:55 am
Location: Viken, Sweden
Contact:

Re: Sending XML file to Web Service

Post by stefan@tageson.se »

Are you using the correct endpoint? It seems like a mixup of a GET with parameters and a POST.
What headers are you adding in your AddHeader procedure?
Scott Klement
Site Admin
Posts: 856
Joined: Sun Jul 04, 2021 5:12 am

Re: Sending XML file to Web Service

Post by Scott Klement »

It's awfully difficult to help you when I don't know how the API is meant to work, I only know what you've coded (which I'm sure is wrong.)

You have a submission-id in the query string portion lf the URL. Is that what it's using to determine the submission id? But then you say something about the XML being "chunked" (I have no idea what that means... do you mean chunked transfer-coding? HTTPAPI never uses that when sending data, so that's not possible.)

Your URL doesn't seem to be encoding the data passed for the submission id, so any characters that have a special meaning in the URL will cause the submission id to have problems. I don't approve of this at all.

You aren't providing a content-type to http_req(). so how does the server know what data you are providing?
Post Reply