Integrating USPS Address Validation: http ShippingAPI.dll

I am looking to get, I think a WSDL, reference set up to be able to use XML messaging for address validation.

The basics of what I want to do is very similar to this: mscerts.wmlcloud.com/…/Microsoft Dynamics AX 2009 The Application Integration Framework (part 8) - Consuming Web Services from Dynamics AX.aspx

Using the USPS address validation web service detailed here: www.usps.com/…/address-information-api.htm

Has anybody done something similar or can point me in the right direction?

My very first hangup is that I get errors when trying to “add Service Reference”

I am not sure what the appropriate ESDL URL would be.

This would be a valid call to their API:

production.shippingapis.com/ShippingAPI.dll USERID=“XXXXXXXXXX”>8000380234

Thank you,

Tim

Are you using what version of AX ? 2012 2009 ?

AX2009

I have opened the link that you have provided and the error isn’t related to add reference in AX. USPS isn’t using Web Services with WSDL reference, it is expecting a HTTP post using an XML format. If I had to do this requirement, I would create a .NET assembly with the http request and answer processing and call the assembly from AX.

That makes a lot of sense. Do you know of any starter examples of post/get .net assemblies that are callable from AX?

I found an awesome link:

Looks a bit dated, but I am sure it will be a great resource.

If you wrap the code of the article that you have found in a .NET assembly you can use it in AX

Right now I am having an issue creating a simple test module. I can’t even get the sample code provided:

///Create a new instance of the USPS Manager class
///The constructor takes 2 arguments, the first is
///your USPS Web Tools User ID and the second is 
///true if you want to use the USPS Test Servers.
USPSManager m = new USPSManager("YOUR_USER_ID", true);
Address a = new Address();
a.Address2 = "6406 Ivy Lane";
a.City = "Greenbelt";
a.State = "MD";

///By calling ValidateAddress on the USPSManager object,
///you get an Address object that has been validated by the
///USPS servers
Address validatedAddress = m.ValidateAddress(a);
</code>
into a test function.

Sorry, but now I’m lost in your issue

The code above just tests the code in the “Web Tools Wrapper”.

So I got a basic .net form to submit the request and all working. – Proof that the wrapper works.

Do you know of any simple wrapper examples that I can use as a guide to getting this particular code “wrapped” for use in AX2009?

Thank you!

This a good startup guide for you. https://www.packtpub.com/books/content/working-microsoft-dynamics-ax-and-net-part-1

Create an assembly and call it from AX