Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating FedEx Web Services into .Net, stuck at step 1

Tags:

wsdl

asmx

fedex

I'm signed up, I've downloaded sample code, I've got a WSDL...and yet I have no idea how to get this stuff into my existing .Net application. The WSDL was in a zip file, not a URL so I can't just "Add Web Reference." I've run the wsdl tool from the .Net command prompt, and it made a nice class for me...yet dropping that into my web_reference folder doesn't give me any kind of instantiatable class.

I know I'm missing something stupid. Can someone point me in the right direction please?

like image 799
Matt Dawdy Avatar asked Apr 05 '10 03:04

Matt Dawdy


2 Answers

The proper way to load the FedEx API WSDL file in Visual Studio 2010:

  1. Open the Solution Explorer
  2. Right click your project
  3. Click 'Add Service Reference'
  4. Click the 'Advanced...' button
  5. Click the 'Add Web Reference...' button
  6. Enter the exact path to the WSDL file for the specific FedEx web reference you're using. For example, I extracted mine to the root of my C:\ drive, so all I entered into the URL field was "C:\ShipService.wsdl" without quotes. If you leave quotes, it won't work.
  7. When you hit go, Visual Studio should consume the wsdl into workable classes for you. Click Add Reference and enjoy!

Note: Make sure you read the FedEx documentation well - a lot of their services have gotchyas and implementation can be a nightmare. For example, their address validation service is consumed incorrectly and creates two-dimensional arrays in Reference.cs where they shouldn't exist - this is detailed in the documentation. Worse yet, the fact that they don't allow address validation on their dev environment isn't documented anywhere! Good luck!

like image 100
mmmeff Avatar answered Sep 18 '22 15:09

mmmeff


Actually, you can just "Add Web Reference". Give the path to the URL.

OTOH, you should be doing all new web service development (even client development) using WCF. Microsoft now considers ASMX web services to be "legacy technology".

BTW, I just tried using their address validation service, and it won't work with .NET. Both ASMX and WCF clients will attempt to use the XML serializer to consume this service, and there is a bug there that prevents that service from being used.

like image 26
John Saunders Avatar answered Sep 19 '22 15:09

John Saunders