This may be a very generalized question but had anyone has much luck with utilizing the UPS Street-level validation API? I have studied portions of this: http://www.codeproject.com/KB/aspnet/Benz_CPE.aspx?msg=3658759&display=Mobile
And this: https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_US
UPS has not been very helpful with their own sample code. Even after obtaining an access key, their sample insists sample data (even with the test-environment-acceptable states) that the state provided is invalid. Looking for more leads.
UPS informed me that the C# sample is configured for "Urbanization" which is only appropriate in Puerto Rico. I modified the code as follows:
class XAVWSClient
{
static void Main()
{
try
{
XAVService xavSvc = new XAVService();
XAVRequest xavRequest = new XAVRequest();
UPSSecurity upss = new UPSSecurity();
UPSSecurityServiceAccessToken upssSvcAccessToken = new UPSSecurityServiceAccessToken();
upssSvcAccessToken.AccessLicenseNumber = ;
upss.ServiceAccessToken = upssSvcAccessToken;
UPSSecurityUsernameToken upssUsrNameToken = new UPSSecurityUsernameToken();
upssUsrNameToken.Username = ;
upssUsrNameToken.Password = ;
upss.UsernameToken = upssUsrNameToken;
xavSvc.UPSSecurityValue = upss;
RequestType request = new RequestType();
//Below code contains dummy data for reference. Please update as required.
String[] requestOption = { "1" };
request.RequestOption = requestOption;
xavRequest.Request = request;
AddressKeyFormatType addressKeyFormat = new AddressKeyFormatType();
String[] addressLine = { "3930 KRISTI COURT" };
addressKeyFormat.AddressLine = addressLine;
addressKeyFormat.PoliticalDivision2 = "SACRAMENTO";
addressKeyFormat.PoliticalDivision1 = "CA";
addressKeyFormat.PostcodePrimaryLow = "95827";
addressKeyFormat.ConsigneeName = "Some Consignee";
addressKeyFormat.CountryCode = "US";
xavRequest.AddressKeyFormat = addressKeyFormat;
System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
//serialize object (Debugging)
System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(xavRequest.GetType());
Stream stream = File.Open("SerializedXAVRequest.xml", FileMode.Create);
x.Serialize(stream, xavRequest);
XAVResponse xavResponse = xavSvc.ProcessXAV(xavRequest);
Console.WriteLine("Response Status Code " + xavResponse.Response.ResponseStatus.Code);
Console.WriteLine("Response Status Description " + xavResponse.Response.ResponseStatus.Description);
Console.ReadLine();
Although I can now validate my credentials, I cannot produce multiple results and I'm not sure it's doing any validation at all considering how even if I put in a bogus address, I receive the following:
Response Status Code 1 Response Status Description Success
When I get to that point in my problem, I'll post another question. Until then, this question is answered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With