× 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.



Here is the debug log. Sorry I forgot to include it in the original email.

I have cut short the Certificate for easier reading-

*Log*
HTTPAPI Ver 1.17 released 2006-09-23



New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0

http_setauth(): entered

New iconv() objects set, PostRem=1208. PostLoc=0. ProtRem=819. ProtLoc=0

http_persist_open(): entered

http_long_ParseURL(): entered

https_init(): entered

-------------------------------------------------------------------------------------
Dump of local-side certificate information:

-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Dump of server-side certificate information:

-------------------------------------------------------------------------------------
Cert Validation Code = 6000

-----BEGIN CERTIFICATE-----

MIIFQDCCBCigAwIBAgIIGMlF8bmCI9kwDQYJKoZIhvcNAQELBQAwgbQxCzAJBgNV

udCsbg==
-----END CERTIFICATE-----
Serial Number: 18:C9:45:F1:B9:82:23:D9
Common Name: *.api.manheim.com
Org: Domain Control Validated
Issuer CN: Go Daddy Secure Certificate Authority - G2
Issuer Country: US
Issuer State/Province: Arizona
Issuer Locality: Scottsdale
Issuer Org: GoDaddy.com, Inc.
Issuer Org: GoDaddy.com, Inc.
Issuer Org Unit: http://certs.godaddy.com/repository/
Unknown Field: 3
Unknown Field: 20150723153240
Unknown Field: 15:32:40 23-07-2015
Unknown Field: 20170723153240
Unknown Field: 15:32:40 23-07-2017
Unknown Field: 1.2.840.113549.1.1.11

Protocol Used: TLS Version 1
http_persist_post(): entered
http_long_ParseURL(): entered
do_post(): entered
POST /oauth2/token
Host: integration1.api.manheim.com
User-Agent: http-api/1.17
Content-Type: text/xml
Expect: 100-continue
Content-Length: 43
Content-Length: 43
Authorization: Basic c2h2bWFoNXB1dTZ5OGsydGFkNTZ3eWdlOjN3Q0NjZ3VyRzg=


recvresp(): entered
HTTP/1.1 400 BAD_REQUEST
Content-Length: 0
Connection: Close


SetError() #13: HTTP/1.1 400 BAD_REQUEST
recvdoc parms: identity 0
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
SetError() #13: HTTP/1.1 400 BAD_REQUEST
http_close(): entered

On Mon, May 9, 2016 at 12:54 PM, Bradley Stone <bvstone@xxxxxxxxx> wrote:

Can you turn on debugging and get a copy of the actual request that was
sent, including headers?

Also, for the response, the same?

Brad
www.bvstools.com

On Mon, May 9, 2016 at 11:12 AM, Shubhadeep Roy <shubhadeep.roy@xxxxxxxxx>
wrote:

Hi,

I am trying to Post to a URL with a username and password to get a token
back using HTTPAPI and YAJL and am getting BAD_REQUEST error. I have also
tried using the following instead of using the yajl set of commands to
generate the JSON-
myJson = '{ "grant_type": "client_credentials" }';

When I debug and check the contents of myJSON, I get junk values-
MYJSON =
....5...10...15...20...25...30...35...40...45
1 ' ÅÊ/>ȬÈ`øÁ Ä%ÑÁ>ȬÄÊÁÀÁ>ÈÑ/%Ë '

Can someone please help?


Here's the code below-
P getAuthToken B Export
D getAuthToken PI 24A
*
D CRLF C X'0d25'
D rc S 10I 0 Inz
D msg S 80A Inz
D runFlag S N Static
D myJSON S 65535A Varying
D size S 10I 0 Inz
*
D dsLogonDetails DS Static
D dsAuthUsr 24A
D dsAuthPwd 24A
D dsAuthUrl 1024A
*
* getLogonInfo Prototype
D getLogonInfo PR 1072A
*
* Parse Incoming Data from http_url_post_raw
D parseHeader PR 10I 0
D 10I 0 Value
D * Value
D 10I 0 Value
*
/Free

http_debug(*ON : '/tmp/ShubhDebugLog.txt');

Clear authUrl;

// If not run, set static variables
If Not runFlag;
runFlag = *On;

// Get logon info
dsLogonDetails = getLogonInfo();
EndIf;


// Set Authorization
http_setauth(HTTP_AUTH_BASIC : dsAuthUsr : dsAuthPwd);
http_setCCSIDs( 1208: 0 );

yajl_genOpen(*ON);
yajl_beginObj();

yajl_addChar('grant_type': 'client_credentials');

yajl_endObj();

yajl_copyBuf( 1208 : %addr(myJson) : %size(myJson) : size);
yajl_genClose();

rc = http_url_post_raw(dsAuthUrl : %addr(myJSON : *data) : size :
1 : %paddr('PARSEHEADER'));

If rc <> 1;
msg = http_error;
EndIf;

Return authToken;

/End-Free
P getAuthToken E


Here's the error message: HTTP/1.1 400 BAD_REQUEST

--

Warm regards,
Shubh
All is well. Everything will be OK!!! - Shubh
​​
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.