For those who have asked me, and those who have commiserated with me on the difficulties of dealing with FedEx’s shipping API, I have some wonderful news.
FedEx, when using their Direct XML transaction methods to ping their service, returns an encoded binary string that is to be used for their shipping labels. I have been messing with it on and off for weeks now ever since we got the system to return information correctly. The problem that arose was that the information we received wasn’t decoding properly (FYI, the returned format was 2DCOMMON as a PNG). I decoded the information but it was still a no go. So I got a brain wave and decided to just make a script to create an image file for it (since its a PNG data anyway) and then display the newly created image in the browser so the client can print it out.
I was floored when it first came up and I saw all the nifty information in the FedEx label. The client can now print these out on a standard printer for the shipments.
I can’t paste the code in here as the meter number and other sensitive info is in the request string but here is basically the process the system goes through for shipping:
- XML formatted shipping request is made the the fedex servers
- XML formatted return string is parsed and thrown into a DB table
- Client goes to the admin and hits the Print Shipping Label button
- Resulting page pings the database for the OutboundLabel string, decodes its using a Base64 decoder, writes it to a PNG file, and displays it on the page.
- Client prints the label and they are off and running.
Im still not exactly sure why I cannot just append the decoded Base64 data in the SRC of the image, but at this point I really don’t care since its working now.
Let me know if this method works for anyone, or if anyone has a better way to go about it. This solution is in ASP with an Access database.
OK. Back to work with me.
-Cheers








