× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks again, Scott. Sorry about mislabeling (LIBHTTP vs. HTTPAPI).

I not getting back anything more valuable in the response, unfortunately. Supposedly, nothing has changed on Web Service end except for URL itself and that they are turning on Basic Authentication from no authentication. In our code, we only added the http_setauth command.

Is the code below barebones enough to work? Will the http_setauth carry over that we want Basic Auth when calling http_string?

http_setOption('SoapAction': '"InventoryByStore"');
http_setauth(HTTP_AUTH_BASIC:UID:Password);
response = http_string('POST': URL: SOAP_Message: 'text/xml');

Thanks!

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Scott Klement
Sent: Wednesday, April 1, 2020 9:59 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: LIBHTTP, Soap POST, and Basic Auth

Hello,

It's not clear why you are calling http_persist_open(), here, as you are not using 'pComm' with any further persist functions. This would not relate to the '400 Bad Request', but it is wasting memory on something that's never used. (Or, at least, not in the code you provided to us.)

With regards to '400 Bad Request', it essentially means that the server you're sending your document to didn't like something about the request.   It could be pretty much anything...   Simply something you've sent wasn't what it expected you to send.

Good servers will send you back a response document -- since this is SOAP, it would be a SOAP message with a "fault" tag in it -- that describes what the problem is.   You say you have a debug log...
consider looking for this response document to see if there's more information.

Aside from that, look at their documentation and compare what they say they expect to what you are sending.

Also... as a minor aside...  please don't refer to HTTPAPI as "LIBHTTP".   Yes, the default library its installed into is named "LIBHTTP", but that's just the name of the library.  The tool is called "HTTPAPI".

-SK


On 4/1/2020 9:09 AM, Stephen Piland wrote:
We have Scott's LIBHTTP v1.39 installed and I'm having issues adding Basic Authentication to a process that was previously working great.

The code below is the shell of what is going on. We added the http_setauth line. Maybe I'm doing it in the wrong order. We are connecting according to the debug log. With the same info, I'm able to connect and post using SoapUI. However, we receive a HTTP 400 Bad Request back in our RPG code. That same HTTP 400 is returned in SoapUI if I pass in a bad UserId and/or password.

Any thoughts? Thanks!

http_setOption('SoapAction': '"InventoryByStore"'); pComm =
http_persist_open(URL); http_setauth(HTTP_AUTH_BASIC:UID:Password);
response = http_string('POST': URL: SOAP_Message: 'text/xml');

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-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 ...

Follow-Ups:
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.