apicoldfusioncoldfusion-10luceehttp-parameters

API Response filecontent is Empty on Lucee server


When i call the canadaPost api in Coldfusion server that is giving the expected response. But when i Use the same call in Lucee server, It throws the message fail. The response header is "Oracle-iPlanet-Web-Server/7.0" for both servers. But the response mimetype is "application/octet-stream" in Lucee server and "application/vnd.cpc.ship.rate-v3+xml" in coldfusion server.

Is that the cause of the issue? Please give your suggestion about this.

Here is my code:

<cfset local.url = "https://ct.soa-gw.canadapost.ca/rs/ship/price">

<cfhttp url="#local.url#" method="post" result="httpResponse" username="#variables.username#" password="#variables.password#">
    <cfhttpparam type="header" name="Accept" value="application/vnd.cpc.ship.rate-v3+xml"/>
    <cfhttpparam type="xml" value="#trim(xmlRequest)#"/>
    <cfhttpparam type="header" name="Content-type" value="application/vnd.cpc.ship.rate-v3+xml">
</cfhttp>

Attached screenshot which is taken on Lucee server:

enter image description here

Thanks


Solution

  • Finally I got the file content value by changed the cfhttpparam type "xml" to "body".

    My Fix:

    <cfset local.url = "https://ct.soa-gw.canadapost.ca/rs/ship/price">
    <cfhttp url="#local.url#" method="post" result="httpResponse" username="#variables.username#" password="#variables.password#">
        <cfhttpparam type="header" name="Accept" value="application/vnd.cpc.ship.rate-v3+xml"/>
        <cfhttpparam type="body" value="#trim(xmlRequest)#"/>
        <cfhttpparam type="header" name="Content-type" value="application/vnd.cpc.ship.rate-v3+xml">
    </cfhttp>
    

    Thank you guyz..