 |
|
 |
Great article/library.
According to the USPS site, FirmName is limited to 38 characters. I've noticed that most of your setters do validations, but perhaps you've forgotten to include this validation for the FirmName property.
|
|
|
|
 |
|
 |
You Ever Finish The FedEx, UPS, & DHL Version Of This?
|
|
|
|
 |
|
 |
If anyone is wondering about shipping in Canada, check out purolator.com/eship for how to do it. I can give advice in more detail too.
|
|
|
|
 |
|
 |
I am completely new to XML so I'm sure I'm missing something fundamental here. I selected what looked like the simplest test - get city and state from zip - and attempted to display the results on a button click. Nuthin! Here's my code:
protected void TestButton_Click(object sender, EventArgs e) { USPSManager m = new USPSManager("//my_user_id//", true); Address a = m.GetCityState("90210"); string city = a.City; string state = a.State; ResultLabel.Text = city + ", " + state; }
Help plz ... thanks.
|
|
|
|
 |
|
 |
Can some one shed some light how to process certified mail using this api?
|
|
|
|
 |
|
 |
I amd recieving 80040b1a API Authorization failure. User xxxxxxxxxxxx is not authorized to use API DeliveryConfirmationV3. UspsCom::DoAuth 
|
|
|
|
 |
|
 |
Hi: I had the same problem, and fixed it by going to the production server. The test server is not set up to work with deliver confirmation. Also, you need to use the secure servers (that is in the email they send you) for the shipping label stuff. The documentation does not tell you this. You have to call them (800-344-7779) and be promoted to the production server:
'For Secure Servers (shipping labels, RMA), use these Private Const ProductionUrl As String = "https://secure.shippingapis.com/ShippingAPI.dll" Private Const TestingUrl As String = "https://secure.shippingapis.com/ShippingAPITest.dll"
'For Standard servers (address check, zip code check), use these Private Const ProductionUrl As String = "http://production.shippingapis.com/ShippingAPI.dll" Private Const TestingUrl As String = "http://testing.shippingapis.com/ShippingAPITest.dll"
Also, remember to use the: API=DelivConfirmCertifyV3 for testing label while on the production server.
Using these server settings, I'm able to retrieve the xml of the delivery confirmation number as well as the shipping label.
Good luck, tim1198
|
|
|
|
 |
|
 |
I used the above coede and getting "The remote server returned an error: (502) Bad Gateway." error
Pls help me on this
modified on Thursday, February 12, 2009 2:43 AM
|
|
|
|
 |
|
 |
I keep getting this error no matter what address zip I put in
<?xml version="1.0"?> <Error><Number>-2147219498</Number><Source>Rate_Respond.DomesticRatesV2Test:clsRatesV2TestValidateParameters:clsRatesV2TestProcessRequest;SOLServerRatesTest.RateV2_Respond</Source><Description>Please enter a valid ZIP Code for the sender. </Description><HelpFile></HelpFile><HelpContext>1000440</HelpContext></Error>
|
|
|
|
 |
|
 |
I'm not sure which function you're validating. In general, when using the test servers to verify address or zip codes, the fields have to match exactly in order for USPS to return the xml without errors. I had to look at the documentation on webtools, and make sure that all fields match exactly like the documentation:
http://www.usps.com/webtools/htm/Address-Information.htm[^]
tim1198
|
|
|
|
 |
|
 |
How Do I Track Packages With This? i Tried The
USPSManager m = new USPSManager("YOUR_USER_ID", true); TrackingInfo t = m.GetTrackingInfo("EJ958083578US");
But It Didn't Work What Else Do I Need To Do?
NVM! Got It Working! i had replaced the EJ958083578US with my tracking number!
modified on Wednesday, December 3, 2008 12:48 PM
|
|
|
|
 |
|
 |
HERE IS AN UPDATE
You will get this error using the V2 Call this # and have them upgrade you to the production server. You also have to ask for shipping label printing privledges too
Telephone: 1-800-344-7779 (7:00AM to 11:00PM EST)
|
|
|
|
 |
|
 |
please tell me how to show the label in pdf file or image file.
p = m.GetDeliveryConfirmationLabel(p);
regards,
|
|
|
|
 |
|
 |
Hi,
First of all many many thanks for sharing this.
I have tried your code and dll and managed to get the delivery confirmation numbers.BUT i could not able to figure out how to show the received byte array to pdf file or tif file.
please help me in this regard.
regards sunny
|
|
|
|
 |
|
 |
The file data returned from USPS is a base64 encoded string.
Change the following in USPSManager.cs:
package.ShippingLabel = StringToUTF8ByteArray(xml.Substring(i1, i2 - i1));
To:
package.ShippingLabel = Convert.FromBase64String(xml.Substring(i1, i2 - i1));
You can then use a FileStream to output the byte array to a file.
|
|
|
|
 |
|
 |
Yes.. saved tons of time...
thanks
-- ASif Ashraf MCAD.Net,MCP Asif.Log@gmail | hotmail.com 92-306-4526526 Technical Lead, Store Secured Inc.
|
|
|
|
 |
|
 |
Hey, Thanks for posting this code.
I did not see an example for rates here, so I started to play with it. First off, you MUST use specific values for getting rate on the test server. You can find these values online. You will always get back invalid zip code if you dont use the correct values. Second, the GetRate method allows you to send "ALL" so you can get many rates. This is how most people would use the system I would gather, as you want a list of rates before you select a rate, right?
This code was not made for "ALL" rate. I added the "ALL". Once You do this, you must send Machinable value. This is not built into the system at all as far as I can see.
If I an missing this, can you point it out? Other than that, I will modify to contain these values. If someone needs the test GetRate values, lemme know -Shane
|
|
|
|
 |
|
 |
Hi, I am currently working with this wrapper code. Do you have the Test data for rates? I cannot find it anywhere
Thanks in advance Glen Colby Sr. Developer Neoreef LLC www.Neoreef.com
bugnuker wrote: Hey, Thanks for posting this code.
I did not see an example for rates here, so I started to play with it. First off, you MUST use specific values for getting rate on the test server. You can find these values online. You will always get back invalid zip code if you dont use the correct values. Second, the GetRate method allows you to send "ALL" so you can get many rates. This is how most people would use the system I would gather, as you want a list of rates before you select a rate, right?
This code was not made for "ALL" rate. I added the "ALL". Once You do this, you must send Machinable value. This is not built into the system at all as far as I can see.
If I an missing this, can you point it out? Other than that, I will modify to contain these values. If someone needs the test GetRate values, lemme know -Shane
|
|
|
|
 |
|
 |
HI, Great article, thanks. Would I be able to get usps international rate with this library? Regards, Tuhin
|
|
|
|
 |
|
 |
This code still saved me a ton of time so you still get my *5*
You need the following change in Address.cs because a zip code response is different :
public static Address FromXml(string xml) { Address a = new Address();
System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(xml);
System.Xml.XmlNode element = doc.SelectSingleNode("/ZipCodeLookupResponse/Address/FirmName"); if (element != null) a._FirmName = element.InnerText; element = doc.SelectSingleNode("/ZipCodeLookupResponse/Address/Address1"); if (element != null) a._Address1 = element.InnerText; element = doc.SelectSingleNode("/ZipCodeLookupResponse/Address/Address2"); if (element != null) a._Address2 = element.InnerText; element = doc.SelectSingleNode("/ZipCodeLookupResponse/Address/City"); if (element != null) a._City = element.InnerText; element = doc.SelectSingleNode("/ZipCodeLookupResponse/Address/State"); if (element != null) a._State = element.InnerText; element = doc.SelectSingleNode("/ZipCodeLookupResponse/Address/Zip5"); if (element != null) a._Zip = element.InnerText; element = doc.SelectSingleNode("/ZipCodeLookupResponse/Address/Zip4"); if (element != null) a._ZipPlus4 = element.InnerText;
return a; }
|
|
|
|
 |
|
 |
Does anyone know if and where the USPS keeps a list of legitimate "events" when you use the tracking-confirm fields tool?
Rick Martin Bearblu.com
|
|
|
|
 |
|
 |
Hi, Thanx for the code. I used this code, in my asp.NET web application. but, as i send the request to the testing server with the data u have specified, the server prompts the error as API Authorization failure. DeliveryConfirmationV3 is not a valid API name for this protocol. Does anyone have any idea about this.. ? Please help me..
Thanx
|
|
|
|
 |
|
 |
I'm also having this issue. If anyone has a clue or has been able to solve it please let me know because I am in desperate need of help solving this.
Thanks
|
|
|
|
 |
|
 |
I'm running into this issue as well. Calling the ICCC is very little help. They seem to have no idea what this issue is. I thought it might be a problem with the referral url in the http header (one of the ICCC people said something to that sort), but i've set it explicitly and still no change. Is it related to user permissions?
I'm trying with the following urls to no avail. Are these the right urls?
http://testing.shippingapis.com/ShippingAPITest.dll?API=DeliveryConfirmationV3&XML=... https://secure.shippingapis.com/ShippingAPITest.dll?API=DeliveryConfirmationV3&XML=...
|
|
|
|
 |
|
 |
The issue is on their side. I sent an email explaining my situation and they replied. I'll post my email and their reply here:
My Email:
Hello. I've just gotten off the phone with the ICCC and wanted to switch to the production server, but I was told that I needed two successful tries, which I cannot get because I keep getting this error. I've already read the technical guide, and I was also told to send my code to the mail department, and patiently wait, which is what I am doing right now. I've already sent an email but didn't send the code. I am developing using Microsoft Visual C# .NET Framework 1.1. I created a new web application, and added a .dll to the references (MSXML2.dll which can be googled and downloaded easily), which I use for the XML. Here is my code:
private void Page_Load(object sender, System.EventArgs e) { string API = "API=DeliveryConfirmationV3&XML="; string USPSUrl = "https://secure.shippingapis.com/ShippingAPITest.dll?"; string strXML = API + "<DeliveryConfirmationV3.0Request USERID=\"XXXXXX\">\n\n<Option>1</Option>\n\n<ImageParameters />\n\n<FromName>John Smith</FromName>\n\n<FromFirm>U.S. Postal Headquarters</FromFirm>\n\n<FromAddress1 />\n\n<FromAddress2>475 L'Enfant Plaza, SW</FromAddress2>\n\n<FromCity>Washington</FromCity>\n\n<FromState>DC</FromState>\n\n<FromZip5>20260</FromZip5>\n\n<FromZip4>0004</FromZip4>\n\n<ToName>Joe Customer</ToName>\n\n<ToFirm>U.S. Postal Service NCSC</ToFirm>\n\n<ToAddress1>STE 201</ToAddress1>\n\n<ToAddress2>6060 PRIMACY PKWY</ToAddress2>\n\n<ToCity>MEMPHIS</ToCity>\n\n<ToState>TN</ToState>\n\n<ToZip5>38119</ToZip5>\n\n<ToZip4>5718</ToZip4>\n\n<WeightInOunces>2</WeightInOunces>\n\n<ServiceType>Priority</ServiceType>\n\n<POZipCode>20260</POZipCode>\n\n<ImageType>TIF</ImageType>\n\n<LabelDate>07/08/2004</LabelDate>\n\n<CustomerRefNo>A45-3928</CustomerRefNo>\n\n<AddressServiceRequested>TRUE</AddressServiceRequested>\n\n</DeliveryConfirmationV3.0Request>";
MSXML2.XMLHTTPClass XMLhttp = new MSXML2.XMLHTTPClass(); XMLhttp.open("POST", USPSUrl, false, null, null); XMLhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); XMLhttp.send(strXML);
string responseMsg = XMLhttp.responseText; string HTTPStatusText = XMLhttp.statusText; int HTTPStatusCode = XMLhttp.status;
Response.Write(responseMsg);
}
Any help is appreciated. I hope this issue can be solved. Thank you.
--
ICCC's reply:
Thank you for contacting the USPS Internet Customer Care Center in regards to Web Tools ID XXXXXXX.
I apologize, it is not currently possible to generate a label from our test servers. Your profile has been updated to allow you access to the Production Server, and you can test your code using sample labels.
1. The Production Server URL is:
http://production.shippingapis.com.
2. Labels require a secure connection. Please use our secure server:
https://secure.shippingapis.com.
3. There is a line of code that refers to "shippingapitest.dll". You'll need to remove the word "test".
Please refer to the "Run Sample Requests" section of our technical guides for more information on generating sample labels:
http://www.usps.com/webtools/technical.htm
Once you have finished testing your code and want to be given access to generate live labels, we need to know whether you will be customizing (e.g. adding your logo, changing the layout, etc...) the labels in any way.
If you are using third party software and need assistance, please contact the vendor of the software. They should be able to assist you in obtaining live information using our APIs.
If you have any additional questions or concerns please contact us again.
--
I hope this helps
|
|
|
|
 |