Json error

Hello Mark,
The reason I submitted this issue is I have the same calls being made to FedEx and the USPS. The USPS returns XML, FedEx returns JSON. Same type of call, processing JSON the same way for UPS and FedEx. All work on ColdFusion and only UPS fails on Lucee(not ColdFusion). That’s why I suggested you guys get a UPS account(it’s free) and see if you can determine what Lucee does or does not like about this one call.

Thanks again!
Have a good day!

Ahh, that makes sense , so the
<cfreturn DeserializeJSON(upsRate.fileContent)/>
Was failing since one returns XML ? Kinda makes sense, so you might need to do a switch.

If ACF is converting XML with DeserializeJSON that sounds odd to me.
Alas I try to help with the information you give me, as setting up a test case might be very different in my environment to yours.

Sorry if you have already done this and I’ve missed it, but quickly reading the thread I can’t see where you have simply dumped the upsRate.fileContent variable to see what you are actually getting back from your http call.

It’s possible Lucee is converting the result to binary if it’s unsure about the content type. I’ve seen Lucee do this where ACF doesn’t in the past. In which case you can force it not to do that by using:

<cfhttp... getAsBinary="false">
1 Like

Mark,
This code is returning JSON, <cfreturn DeserializeJSON(upsRate.fileContent)/>
They are 3 separate CFC functions. USPS documents their API as returning XML. FedEx and UPS document their API’s as returning JSON. USPS(XML) works fine on both Lucee and ColdFusion. Fedex(JSON) returns JSON, works fine on both Lucee and Coldfusion. UPS(JSON) returns JSON, FAILS on Lucee works on ColdFusion.

I don’t know what else to say!

Just dump(upsRate.fileContent) and we can see what it returned.
So we can see what the issue could be.

Here is the data returned from UPS on ColdFusion

{“RateResponse”:{“Response”:{“ResponseStatus”:{“Code”:“1”, “Description”:“Success”}, “Alert”:[{“Code”:“110971”, “Description”:“Your invoice may vary from the displayed reference rates”}], “TransactionReference”:{“CustomerContext”:“UPS Quotes”, “TransactionIdentifier”:“xwssoas282g6j2x7rRh20S”}}, “RatedShipment”:[{“Service”:{“Code”:“01”, “Description”:“”}, “RatedShipmentAlert”:{“Code”:“110971”, “Description”:“Your invoice may vary from the displayed reference rates”}, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}, “TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“338.52”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“338.52”}, “GuaranteedDelivery”:{“BusinessDaysInTransit”:“1”, “DeliveryByTime”:“10:30 A.M.”}, “RatedPackage”:{“TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“338.52”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“288.72”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ItemizedCharges”:{“Code”:“375”, “CurrencyCode”:“USD”, “MonetaryValue”:“49.80”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“338.52”}, “Weight”:“16.0”, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}}}, {“Service”:{“Code”:“02”, “Description”:“”}, “RatedShipmentAlert”:{“Code”:“110971”, “Description”:“Your invoice may vary from the displayed reference rates”}, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}, “TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“116.84”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“116.84”}, “GuaranteedDelivery”:{“BusinessDaysInTransit”:“2”}, “RatedPackage”:{“TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“116.84”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“99.65”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ItemizedCharges”:{“Code”:“375”, “CurrencyCode”:“USD”, “MonetaryValue”:“17.19”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“116.84”}, “Weight”:“16.0”, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}}}, {“Service”:{“Code”:“03”, “Description”:“”}, “RatedShipmentAlert”:{“Code”:“110971”, “Description”:“Your invoice may vary from the displayed reference rates”}, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}, “TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“29.79”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“29.79”}, “RatedPackage”:{“TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“29.79”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“25.79”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ItemizedCharges”:{“Code”:“375”, “CurrencyCode”:“USD”, “MonetaryValue”:“4.00”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“29.79”}, “Weight”:“16.0”, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}}}, {“Service”:{“Code”:“12”, “Description”:“”}, “RatedShipmentAlert”:{“Code”:“110971”, “Description”:“Your invoice may vary from the displayed reference rates”}, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}, “TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“85.11”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“85.11”}, “GuaranteedDelivery”:{“BusinessDaysInTransit”:“3”}, “RatedPackage”:{“TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“85.11”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“72.59”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ItemizedCharges”:{“Code”:“375”, “CurrencyCode”:“USD”, “MonetaryValue”:“12.52”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“85.11”}, “Weight”:“16.0”, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}}}, {“Service”:{“Code”:“13”, “Description”:“”}, “RatedShipmentAlert”:{“Code”:“110971”, “Description”:“Your invoice may vary from the displayed reference rates”}, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}, “TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“318.46”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“318.46”}, “GuaranteedDelivery”:{“BusinessDaysInTransit”:“1”, “DeliveryByTime”:“3:00 P.M.”}, “RatedPackage”:{“TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“318.46”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“271.61”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ItemizedCharges”:{“Code”:“375”, “CurrencyCode”:“USD”, “MonetaryValue”:“46.85”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“318.46”}, “Weight”:“16.0”, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}}}, {“Service”:{“Code”:“14”, “Description”:“”}, “RatedShipmentAlert”:{“Code”:“110971”, “Description”:“Your invoice may vary from the displayed reference rates”}, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}, “TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“373.70”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“373.70”}, “GuaranteedDelivery”:{“BusinessDaysInTransit”:“1”, “DeliveryByTime”:“8:00 A.M.”}, “RatedPackage”:{“TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“373.70”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“318.72”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ItemizedCharges”:{“Code”:“375”, “CurrencyCode”:“USD”, “MonetaryValue”:“54.98”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“373.70”}, “Weight”:“16.0”, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}}}, {“Service”:{“Code”:“59”, “Description”:“”}, “RatedShipmentAlert”:{“Code”:“110971”, “Description”:“Your invoice may vary from the displayed reference rates”}, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}, “TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“139.54”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“139.54”}, “GuaranteedDelivery”:{“BusinessDaysInTransit”:“2”, “DeliveryByTime”:“10:30 A.M.”}, “RatedPackage”:{“TransportationCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“139.54”}, “BaseServiceCharge”:{“CurrencyCode”:“USD”, “MonetaryValue”:“119.01”}, “ServiceOptionsCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“0.00”}, “ItemizedCharges”:{“Code”:“375”, “CurrencyCode”:“USD”, “MonetaryValue”:“20.53”}, “TotalCharges”:{“CurrencyCode”:“USD”, “MonetaryValue”:“139.54”}, “Weight”:“16.0”, “BillingWeight”:{“UnitOfMeasurement”:{“Code”:“LBS”, “Description”:“Pounds”}, “Weight”:“29.0”}}}]}}

RIght, but what does Lucee return?

1 Like

Or <cfdump var="#upsRate.fileContent#" abort="true"> if you prefer.

Mark,

It is happening on oAuth authentication. I got it working on Lucee by removing parseJSON on the data being returned. Now it does not work on ColdFusion.

Function running;

success: function(response) {
console.log(response);
var upsoAuth = new Object();
upsoAuth = $.parseJSON(response); //ColdFusion Code
// upsoAuth = response; Lucee Code
$.fn.getUPSRate(upsoAuth);
}

oAuth JSON returned;

{“status”:“approved”,“issued_at”:1707935275419,“client_id”:“jJ3pTNziGxWYUjqW6PCC4JARgOrNFLq1VTfeNgdNjDbqwSNn”,“access_token”:"eyJraWQiOiI2NGM0YjYyMC0yZmFhLTQzNTYtYjA0MS1mM2EwZjM2Y2MxZmEiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzM4NCJ9.eyJzdWIiOiJkdGltY3p5

To me it looks like you are unable to tell us, what you are getting from Lucee. Again, showing what CF is sending, won’t help. We need to see what you are getting from Lucee. And you don’t need to console.log it with JS to know it. You need to see the response with Lucee. So please, show it to us (use Chrome Dev Tool)

Andreas,

I am not unable, just very busy. Again, you can always get a UPS Account(free) and take that code I sent and see what you get.

Here you go Andreas,

This is what comes back in Lucee from the CFHTTP call before being Desearialized

{“token_type”:“Bearer”,“issued_at”:“1707938557194”,“client_id”:“jJ3pTNziGxWYUjqW6PCC4JARgOrNFLq1VTfeNgdNjDbqwSNn”,“access_token”:“eyJraWQiOiI2NGM0YjYyMC0yZmFhLTQzNTYtYjA0MS1mM2EwZjM2Y2MxZmEiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzM4NCJ9.eyJzdWIiOiJkdGltY3p5a0BtZ2xhc3MuY29tIiwiY2xpZW50aWQiOiJqSjNwVE56aUd4V1lVanFXNlBDQzRKQVJnT3JORkxxMVZUZmVOZ2ROakRicXdTTm4iLCJpc3MiOiJodHRwczovL2FwaXMudXBzLmNvbSIsInV1aWQiOiIyOUY1MzEyMi1ERTAzLTE2ODAtODZENi00MzdEMjEwODg2RkIiLCJzaWQiOiI2NGM0YjYyMC0yZmFhLTQzNTYtYjA0MS1mM2EwZjM2Y2MxZmEiLCJhdWQiOiJUTlMiLCJhdCI6InFndUIxWE9oRTd2MDFLdTBWQXBZZ1Q2R290em4iLCJuYmYiOjE3MDc5Mzg1NTcsIkRpc3BsYXlOYW1lIjoiVE5TIiwiZXhwIjoxNzA3OTUyOTU3LCJpYXQiOjE3MDc5Mzg1NTcsImp0aSI6Ijc5YThiOTFkLWJkYzItNDlhNS1hMDc3LTNhY2NmZmQ5ODI1ZSJ9.aJBQtpSSjmLzsptLZ4yPajylFvpJMZxYmfJduuTXZQkPrfrpopOCnEJSPBK3fDH6f2azX0ZC3UxY456GdMeSa-F0rP_FA40_5O85VWmYsPnA10zNftnskTXYuajK4wWooHgZeiwEG7xw5TGiVTYoSkF81favaT7usQhys-MGkE1Im8McqGD9s1xANT4o_JJectRxdBn9WbpM6pAPRPbXjXy680L2Hb1OsMBcvtSudqAco2oUcflbzBJJKekIBJA9HZ2pljhJYkOLhgFsoAFgqkeZo0wIM70C7hlJcrHS_32SVfdI-HBZYtIV3xyFAl3ljPPX6jQVRP9KM2LMYOm6WysT5iSce2aEMdY6mvN9l7ihExDcJHBTuB0xHgZ62RIkKNOB7augoQ4UL85cN00VG2WSM8lEPX4ssYNC_BHnsUpfTPQQuIpHbyciVDGjrApvrp5pcrlL8AzNIxXvDQ9b2v9NNCqoEUdu8GuG6SGUxMOd_qXElSOgCFfX2hExOLcndOb-ZX6zD2fWuruXTDaZ4dktfMECMk1Caf5nDQ1Eb4_eTqPcODRAUAexVcJBb9g4d4AfKnj9Je__SrOygO9ffFCP4dWuXITLLRQskAUPRcGczGyU3N_qJmgklw3Yu-qybGeiPWMMFNXXR89NFq69do0eZa0WJZWQrEOzV5Hq8No”,“expires_in”:“14399”,“status”:“approved”}

One other issue we noticed is when first logging in after sitting overnight, it takes around 5 seconds for a response.
Doing the same on ACG is less than 1 second. Any ideas, settings?

After initial login everything runs fine. Does Lucee “go to sleep” after being idle for a while?

Thanks

I am going to take a wild stab in the dark, without knowing your system, but did you do some kind of oatuh login for the ACF server that needs to be done for the Lucee server?
As what you are getting is the oatuh token with the access_token ?

UPS requires oAuth authentication. I make a call passing our credentials and they return a token, which is the JSON I sent you.

Still, this is not the data that is being sent by Lucee that you say is supposely syntatically a broken JSON and breaking your front end JSON consumption. Please provide the data that is breaking your JS and NOT ANY ACF JSON data. We are going in circles here and not getting any furher.

2 Likes

Andreas, don’t worry about it. Consider it closed.

Thank you!

This has to be one of the biggest wastes of good people’s time that I have seen on these forums.

Plenty of ppl trying to help. OP just interested in vapid rhetoric “works on x; doesn’t work on y”.

@wmcrank you should be ashamed of yerself pal. Seriously.

SMH.

2 Likes

Maybe just one of you guys should handle the issue instead of 5. YOU have also wasted my time. Seriously!

None of us should have

4 Likes