× 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 Henrik but no that made no difference.

When you call http_xproc( HTTP_POINT_ADDL_HEADER : *NULL ); all it does
is update the values of the procedure to be called to set the headers.

It does NOT actually reset the headers to *NULL.

So I still have the same error;
SetError() #13: HTTP/1.1 400 Bad Request
recvresp(): end with 400
recvdoc parms: identity 116
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
{"fault":{"faultstring":"Duplicate Header
\"Content-Type\"","detail":{"errorcode":"protocol.http.DuplicateHeader"}}}

SetError() #13: HTTP/1.1 400 Bad Request
http_close(): entered


Don Brown


"WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx> wrote on 16/02/2019 11:02:53
PM:

From: "Henrik Rützou" <hr@xxxxxxxxxxxx>
To: "Web Enabling the IBM i (AS/400 and iSeries)"
<web400@xxxxxxxxxxxxxxxxxx>
Date: 16/02/2019 11:03 PM
Subject: Re: [WEB400] HTTPAPI Error - Duplicate Header
Sent by: "WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx>

I think that this will do the trick and reset the first header:

http_xproc(HTTP_POINT_ADDL_HEADER: *null);


On Sat, Feb 16, 2019 at 1:52 PM Don Brown <DBrown@xxxxxxxxxx> wrote:

Note: ftpapi@xxxxxxxxxxxxxxxxxxxxxx mailing list is still not
operational.


I am having a problem where I am receiving the error of a Duplicate
Header

The test program I am writing retrieves a token from a REST service
and
then uses the authentication token to POST json data to the REST
Service.

I am using http_xproc( HTTP_POINT_ADDL_HEADER to set the header
authentication details.

The request to retrieve the token succeeds but then I need to set new
headers to be able to POST the json data.

I can not find an option to Clear the header.

The debug log is showing two Content-Types and I think based on the
error
message this is the reason for the error.

The code and debug log is below.

Hoping someone has come across this issue and can advise how to
resolve
it.

Thanks

Relevant code snippet and Debug log follows;

uri = 'https://uat.api.onegov.nsw.gov.au/+
/oauth/client_credential/accesstoken+
?grant_type=client_credentials';

http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(tokenHeaders) );

rc = http_url_get(uri: jsonFileName );
if (rc <> 1);
http_crash();
endif;

Data-into aaaaa %Data( jsonFileName :
'doc=file case=convert countprefix=num_')
%Parser( 'YAJL72/YAJLINTO' );


myjsonTrips = '{ +
"rideshareDetail": +
{ +
"submittedDateFrom": "01/01/2018 05:12:12 AM", +
"submittedDateTo": "01/02/2018 05:12:56 PM", +
"vehicleRegistration": "test", +
"policyNumber": "", +
"ctpInsurer": "", +
"tripDetail": [ +
{ +
"tripId": "BBR1009", +
"tripStartDateTime": "02/01/2018 10:45:12 AM",
+
"tripEndDateTime": "05/01/2018 12:45:12 PM", +
"tripDistance": "15", +
"tripStartPostcode": "2000", +
"tripStartSuburb": "SYDNEY", +
"tripAmount": "20.30" +
}, +
{ +
"tripId": "BBR1505", +
"tripStartDateTime": "07/01/2018 01:15:56 PM",
+
"tripEndDateTime": "08/01/2018 02:30:00 PM", +
"tripDistance": "15", +
"tripDistance": "15", +
"tripStartPostcode": "2000", +
"tripStartSuburb": "SYDNEY", +
"tripAmount": "20.30" +
} +
] +
} +
}' ;

http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(tripHeaders) );

uri = 'https://uat.api.onegov.nsw.gov.au+
/P2PRideshare/v1/operator/tripdetails/submit';

rc = http_url_post(uri
: %addr(myjsontrips) + 2
: %len(%trim(myjsontrips))
: jsonfilename2) ;

P tokenHeaders B
D tokenHeaders PI
D Header 1024A varying
D UserData * value
/free
Header = 'Postman-Token: f6a0e906-b1cf-4e13-8da8-023274871bd4'
+ x'0d25'
+ ' apikey: WmTFrOi8ZXBa0RBn6Tx2vYd3dnkOgtjj'
+ x'0d25'
+ 'authorization: Basic +
V21URnJPaThaWEJhMFJCbjZUeDJ2WWQzZG5rT2d0amo6cnRUcjk5amtockNhV0Z0aA'
+ x'0d25'
+ 'cache-control: no-cache'
+ x'0d25';
/end-free
P E

P tripHeaders B
D tripHeaders PI
D Header 1024A varying
D UserData * value
/free
Header = 'Content-Type: application/json'
+ x'0d25'
+ 'Postman-Token: 5becf8a5-db3c-4cf7-8941-3d38e4b9343b'
+ x'0d25'
+ 'apikey: WmTFrOi8ZXBa0RBn6Tx2vYd3dnkOgtjj'
+ x'0d25'
+ 'authorization: Bearer ' + %trim(aaaaa.access_Token)
+ x'0d25'
+ 'transactionID: 22245678'
+ x'0d25'
+ 'requestTimeStamp: 04/06/2018 03:10:22 pm'
+ x'0d25'
+ 'cache-control: no-cache'
+ x'0d25'
+ 'userID: Don'
+ x'0d25';
/end-free
P E


Debug Log

HTTPAPI Ver 1.24 released 2012-01-23
OS/400 Ver V7R3M0

New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819.
ProtLoc=0
http_url_post(): entered
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: MSD.LOCAL
DNS server found: 10.1.1.31
DNS server found: 8.8.8.8
https_init(): entered

SetError() #49: SSL_protocol: Unknown protocol 596
Protocol Used:
http_persist_post(): entered
http_persist_req(POST) entered.
http_long_ParseURL(): entered
do_oper(POST): entered
There are 0 cookies in the cache
POST /P2PRideshare/v1/operator/tripdetails/submit HTTP/1.1
Host: uat.api.onegov.nsw.gov.au
User-Agent: http-api/1.24
Content-Type: text/xml
Content-Length: 644
Content-Type: application/json
Postman-Token: 5becf8a5-db3c-4cf7-8941-3d38e4b9343b
apikey: WmTFrOi8ZXBa0RBn6Tx2vYd3dnkOgtjj
authorization: Bearer 7ewaNweVb0Y5Odu8ikSaAfZjkoqA
transactionID: 22245678
requestTimeStamp: 04/06/2018 03:10:22 pm
cache-control: no-cache
userID: Don.Brown@xxxxxxxxxx

senddoc(): entered
{ "rideshareDetail": { "submittedDateFrom": "01/01/2018 05:12:12 AM",
recvresp(): entered
HTTP/1.1 400 Bad Request
Date: Sat, 16 Feb 2019 05:58:07 GMT
Content-Type: application/json
Content-Length: 116
Connection: keep-alive
X-Frame-Options: DENY
Strict-Transport-Security: max-age=86400
X-Content-Type-Options: nosniff
Content-Security-Policy: frame-ancestors 'none'
X-XSS-Protection: 1

SetError() #13: HTTP/1.1 400 Bad Request
recvresp(): end with 400
recvdoc parms: identity 116
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
{"fault":{"faultstring":"Duplicate Header

\"Content-Type\"","detail":{"errorcode":"protocol.http.DuplicateHeader"}}}

SetError() #13: HTTP/1.1 400 Bad Request
http_close(): entered


Don Brown

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud
service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.



--
Regards,
Henrik Rützou

http://powerEXT.org
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud
service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

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.