[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Ftpapi Digest, Vol 115, Issue 8



Hi Roy,

Have you populated variable jsonBuf?

Best Regards


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of ftpapi-request@xxxxxxxxxxxxxxxxxxxxxx
Sent: Thursday, May 12, 2016 10:08 PM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: Ftpapi Digest, Vol 115, Issue 8

Send Ftpapi mailing list submissions to
	ftpapi@xxxxxxxxxxxxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
	http://scottklement.com/mailman/listinfo/ftpapi
or, via email, send a message with subject or body 'help' to
	ftpapi-request@xxxxxxxxxxxxxxxxxxxxxx

You can reach the person managing the list at
	ftpapi-owner@xxxxxxxxxxxxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Ftpapi digest..."


Today's Topics:

   1. Re: Ftpapi Digest, Vol 115, Issue 4 (Shubhadeep Roy)


----------------------------------------------------------------------

Message: 1
Date: Thu, 12 May 2016 16:08:05 -0400
From: Shubhadeep Roy <shubhadeep.roy@xxxxxxxxx>
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Ftpapi Digest, Vol 115, Issue 4
Message-ID:
	<CAJu=x68DzrSvJ9X9oO0UEeKA78kbuCFSzrCKEF1oGHKoStb0uQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="utf-8"

Hi Scott,

Please help me with this issue.

I learnt that the BODY is not necessary to get the OAuth token. I did the
following changes-
1. Removed the Body part from the code
2. Changed the Content-Type to 'application/json'

http_setauth is working fine as I can see the Header getting generated
correctly for Authorization.

The code is still returning with BAD_REQUEST error. Is there a way to get
the complete Request to show in the log somehow? I have the http_debug as
ON.

Here's the code and the debug log-

*Code-*
D authUrl         S           1024A   Inz
D authToken       S             24A   Inz

/copy qrpglesrc,httpapi_h
/copy qrpglesrc,errno_h
/include qrpglesrc,yajl_h

D getAuthToken    PR            24A

P getAuthToken    B                   Export
D getAuthToken    PI            24A
 *
D fd              S             10I 0 Inz(3)
D CRLF            C                   X'0d25'
D rc              S             10I 0 Inz
D msg             S            500A   Inz
D runFlag         S               N   Static
D jsonBuf         S          20000A   Varying
 *
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;

  http_setauth(HTTP_AUTH_BASIC : dsAuthUsr : dsAuthPwd);
  http_setCCSIDs( 1208: 0 );

  rc = http_url_post_raw( dsAuthUrl
                         :%addr(jsonBuf)
                         :%len(%trimr(jsonBuf))
                         :1
                         :%paddr('PARSEHEADER')
                         :HTTP_TIMEOUT
                         :HTTP_USERAGENT
                         :'application/json' );

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

  Return authToken;

 /End-Free


*Debug 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 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: application/json
Expect: 100-continue
Content-Length: 0
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
 ************End of Data********************


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------