ssl_error(415): (GSKit) Peer not recognized or badly formatted message received.
Posted: Fri Oct 13, 2023 1:48 pm
I'm getting an error on an API call when I use http_req(), but when I send the same payload using Postman, it works fine.
This seems to be an intermittent problem when calling the API from my IBM i. But it succeeds 100% of the time when called from Postman. Any help understanding the error would be greatly appreciated.
Debug Data:
HTTPAPI Ver 1.42 released 2020-10-12
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R4M0
2023-10-13-13.43.56.112415: http_persist_open(): entered
2023-10-13-13.43.56.133356: http_long_ParseURL(): entered
2023-10-13-13.43.56.133492: DNS resolver retrans: 2
2023-10-13-13.43.56.133519: DNS resolver retry : 2
2023-10-13-13.43.56.133545: DNS resolver options: x'00000136'
2023-10-13-13.43.56.133586: DNS default domain: AMSCAN.CORP
2023-10-13-13.43.56.133615: DNS server found: 10.122.201.145
2023-10-13-13.43.56.133639: DNS server found: 10.13.106.77
2023-10-13-13.43.56.133665: DNS server found: 10.122.201.146
2023-10-13-13.43.56.181728: Nagle's algorithm (TCP_NODELAY) disabled.
2023-10-13-13.43.56.403779: SNI hostname set to: api.omniparcel.com
2023-10-13-13.43.56.697841: (GSKit) Peer not recognized or badly formatted message received.
2023-10-13-13.43.56.697974: ssl_error(415): (GSKit) Peer not recognized or badly formatted message received.
2023-10-13-13.43.56.698013: SetError() #30: SSL Handshake: (GSKit) Peer not recognized or badly formatted message received.
2023-10-13-13.43.56.698057: http_close(): entered
RPG Code:
// Activate debug logging (normally commented out)
http_debug(*On :'/s2k/temp/debug_wntms0b1.txt');
http_setDebugLevel(2);
// Set the CCSID to UTF-8 for API data
http_setCCSIDs(1208: 0);
// Create the consignment
Monitor;
http_xproc(HTTP_POINT_ADDL_HEADER
:%paddr(addSpecialHeaders)
);
rc = http_req('POST'
:%trim(url)
:*omit
:response
:*omit
:request
:'application/json'
);
JSON Payload:
{
"DeliveryReference": "1675199",
"Reference2": "1990133-000",
"Reference3": "MK0200768994",
"issignaturerequired": false,
"DutiesAndTaxesByReceiver": false,
"PrintToPrinter": false,
"IncludeLineDetails": true,
"Service": "eCommerce Standard Tracked",
"Outputs": [
"LABEL_ZPL_100X150"
],
"Origin": {
"Name": "Ginger Ray",
"ContactPerson": "Operations Supervisor",
"PhoneNumber": "0000000000",
"Email": "customerservice@amscan-uk.co.uk",
"Address": {
"BuildingName": "c/o Amscan International",
"StreetAddress": "Brudenell Drive",
"Suburb": "Brinklow",
"City": "Milton Keynes",
"PostCode": "MK10 0DA",
"CountryCode": "GB"
}
},
"Destination": {
"Name": "Bob Somebody",
"ContactPerson": "Bob Somebody",
"PhoneNumber": "(914) 111-2222",
"Email": "bobsomebody@gmail.com",
"SendTrackingEmail": true,
"Address": {
"BuildingName": null,
"StreetAddress": "1234 Rainbow Cove",
"Suburb": "Elmsford",
"City": "Elmsford",
"PostCode": "10523",
"CountryCode": "US"
}
},
"Packages": [
{
"Name": "0001 : KE8 LARGE GINGER RAY BAG",
"Length": 30.0000,
"Width": 30.0000,
"Height": 10.0000,
"Kg": 0.3600,
"Type": "Bag",
"OverLabelBarcode": "MK0200768994"
}
],
"Commodities": [
{
"Description": "Magician Burgundy Cape",
"HarmonizedCode": "6114300000",
"Units": 1,
"UnitValue": 34.5000,
"UnitKg": 0.2600,
"Currency": "GBP",
"Country": "CN",
"ItemSKU": "FD-125",
"IsDG": false
}
]
}
This seems to be an intermittent problem when calling the API from my IBM i. But it succeeds 100% of the time when called from Postman. Any help understanding the error would be greatly appreciated.
Debug Data:
HTTPAPI Ver 1.42 released 2020-10-12
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R4M0
2023-10-13-13.43.56.112415: http_persist_open(): entered
2023-10-13-13.43.56.133356: http_long_ParseURL(): entered
2023-10-13-13.43.56.133492: DNS resolver retrans: 2
2023-10-13-13.43.56.133519: DNS resolver retry : 2
2023-10-13-13.43.56.133545: DNS resolver options: x'00000136'
2023-10-13-13.43.56.133586: DNS default domain: AMSCAN.CORP
2023-10-13-13.43.56.133615: DNS server found: 10.122.201.145
2023-10-13-13.43.56.133639: DNS server found: 10.13.106.77
2023-10-13-13.43.56.133665: DNS server found: 10.122.201.146
2023-10-13-13.43.56.181728: Nagle's algorithm (TCP_NODELAY) disabled.
2023-10-13-13.43.56.403779: SNI hostname set to: api.omniparcel.com
2023-10-13-13.43.56.697841: (GSKit) Peer not recognized or badly formatted message received.
2023-10-13-13.43.56.697974: ssl_error(415): (GSKit) Peer not recognized or badly formatted message received.
2023-10-13-13.43.56.698013: SetError() #30: SSL Handshake: (GSKit) Peer not recognized or badly formatted message received.
2023-10-13-13.43.56.698057: http_close(): entered
RPG Code:
// Activate debug logging (normally commented out)
http_debug(*On :'/s2k/temp/debug_wntms0b1.txt');
http_setDebugLevel(2);
// Set the CCSID to UTF-8 for API data
http_setCCSIDs(1208: 0);
// Create the consignment
Monitor;
http_xproc(HTTP_POINT_ADDL_HEADER
:%paddr(addSpecialHeaders)
);
rc = http_req('POST'
:%trim(url)
:*omit
:response
:*omit
:request
:'application/json'
);
JSON Payload:
{
"DeliveryReference": "1675199",
"Reference2": "1990133-000",
"Reference3": "MK0200768994",
"issignaturerequired": false,
"DutiesAndTaxesByReceiver": false,
"PrintToPrinter": false,
"IncludeLineDetails": true,
"Service": "eCommerce Standard Tracked",
"Outputs": [
"LABEL_ZPL_100X150"
],
"Origin": {
"Name": "Ginger Ray",
"ContactPerson": "Operations Supervisor",
"PhoneNumber": "0000000000",
"Email": "customerservice@amscan-uk.co.uk",
"Address": {
"BuildingName": "c/o Amscan International",
"StreetAddress": "Brudenell Drive",
"Suburb": "Brinklow",
"City": "Milton Keynes",
"PostCode": "MK10 0DA",
"CountryCode": "GB"
}
},
"Destination": {
"Name": "Bob Somebody",
"ContactPerson": "Bob Somebody",
"PhoneNumber": "(914) 111-2222",
"Email": "bobsomebody@gmail.com",
"SendTrackingEmail": true,
"Address": {
"BuildingName": null,
"StreetAddress": "1234 Rainbow Cove",
"Suburb": "Elmsford",
"City": "Elmsford",
"PostCode": "10523",
"CountryCode": "US"
}
},
"Packages": [
{
"Name": "0001 : KE8 LARGE GINGER RAY BAG",
"Length": 30.0000,
"Width": 30.0000,
"Height": 10.0000,
"Kg": 0.3600,
"Type": "Bag",
"OverLabelBarcode": "MK0200768994"
}
],
"Commodities": [
{
"Description": "Magician Burgundy Cape",
"HarmonizedCode": "6114300000",
"Units": 1,
"UnitValue": 34.5000,
"UnitKg": 0.2600,
"Currency": "GBP",
"Country": "CN",
"ItemSKU": "FD-125",
"IsDG": false
}
]
}