919 - 926 - 9847

Fedex interactions... you are a bleeding pain

There has been some talk on CF-Talk lately about interacting with the Fedex WSDL/services. There's not really much in the way of examples that I could easily find on how to use this WSDL... and I've still not gotten over my hate of working with CFHTTP and authorize.net. I was hopping to not have to deal with that pain again, and it seems I won't!

So, we have this link to a most excellent (and free!) CFC here. You'll still need to step through the hoops to get a developer code from Fedex, but once you do...


<cfinvoke component="fedex" method="getRates" returnvariable="fedex"
shipperAddress1 =     "474 N Centre St"
shipperCity =         "Pottsville"
shipperState =         "PA"
shipperZip =         "17972"
shiptoAddress1 =     "79 TW Alexander Dr"
shiptoCity =        "Durham"
shiptoState =         "NC"
shiptoZip =         "27709"
pkgWeight =            "3"
pkgValue =             "100"
myKey =    "<your value>"
myPassword="<your value>"
myAccountNo="<your value>"
myMeterNo="<your value>"
>


<cfdump var="#fedex#">
    <cfoutput>
    <select name="shipping">
            <cfloop from="1" to="#arraylen(fedex.rate)#" index="n">
                <option value="#fedex.rate[n].cost#">#fedex.rate[n].type# - #DollarFormat(fedex.rate[n].cost)#</option>
            </cfloop>
    </select>
    </cfoutput>
This example (provided by the original author) includes a handy select box. This is great for me, and saves a TON of time playing with the XML.

PS.... I forgot to close the code block... I'm thinking BlogCFC could use a rich text editor.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Kurt Wiersma's Gravatar We had pretty good success with their old API after we figured out some items that were missing in their documentation. In their old XML API (per WSDL) they basically didn't have any good examples. We found some example CF code online that answered a lot of our questions. Unfortunately it appears they don't have documentation available for the old API although they will answer questions if you call them. I have actually talked to knowledgeable, English speaking people when calling their developer support.
# Posted By Kurt Wiersma | 7/8/09 10:42 PM
Matthew Williams's Gravatar At this point, I'm happy with what we have going. The client has no need for anything but the rate data at this time, so hats off to the bloke that created the linked CFC. We'll see as we move toward production if this will still work correctly.
# Posted By Matthew Williams | 7/9/09 6:00 PM