static void Main(string[] args) { ValidatePostalRequest request = CreateValidatePostalRequest(); // CountryService service = new CountryService(); if (usePropertyFile()) { service.Url = getProperty("endpoint"); } // try { ValidatePostalReply reply = service.validatePostal(request); if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING) { ShowValidatePostalReply(reply); } else { Console.WriteLine("Postal Code Inquiry failed : {0}", reply.Notifications[0].Message); } } catch (SoapException e) { Console.WriteLine(e.Detail.InnerText); } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine("Press any key to quit!"); Console.ReadKey(); }
private static ValidatePostalRequest CreateValidatePostalRequest() { // Build the PostalCodeInquiryRequest ValidatePostalRequest request = new ValidatePostalRequest(); // request.WebAuthenticationDetail = new WebAuthenticationDetail(); request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential(); request.WebAuthenticationDetail.UserCredential.Key = "V4bqDWokgOVi4qsy"; // Replace "XXX" with the Key request.WebAuthenticationDetail.UserCredential.Password = "******"; // Replace "XXX" with the Password if (usePropertyFile()) //Set values from a file for testing purposes { request.WebAuthenticationDetail.UserCredential.Key = getProperty("key"); request.WebAuthenticationDetail.UserCredential.Password = getProperty("password"); } // request.ClientDetail = new ClientDetail(); request.ClientDetail.AccountNumber = "510087500"; // Replace "XXX" with the client's account number request.ClientDetail.MeterNumber = "118687440"; // Replace "XXX" with the client's meter number if (usePropertyFile()) //Set values from a file for testing purposes { request.ClientDetail.AccountNumber = getProperty("accountnumber"); request.ClientDetail.MeterNumber = getProperty("meternumber"); } // request.TransactionDetail = new TransactionDetail(); request.TransactionDetail.CustomerTransactionId = "***Validate Postal Service Request using VC#***"; // The client will get the same value back in the response // request.Version = new VersionId(); // Creates the Version element with all child elements populated from the wsdl // request.CarrierCode = CarrierCodeType.FDXE; request.CarrierCodeSpecified = true; request.Address = new Address(); //request.Address.PostalCode = "32810"; //request.Address.CountryCode = "US"; request.Address.PostalCode = "M6K1A7"; request.Address.City = "Toronto"; request.Address.StateOrProvinceCode = "ON"; request.Address.StreetLines = new string[] { "135 Yonge St." }; request.Address.CountryCode = "CA"; return(request); }
private static ValidatePostalRequest CreateValidatePostalRequest() { // Build the PostalCodeInquiryRequest ValidatePostalRequest request = new ValidatePostalRequest(); // request.WebAuthenticationDetail = new WebAuthenticationDetail(); request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential(); request.WebAuthenticationDetail.UserCredential.Key = "XXX"; // Replace "XXX" with the Key request.WebAuthenticationDetail.UserCredential.Password = "******"; // Replace "XXX" with the Password if (usePropertyFile()) //Set values from a file for testing purposes { request.WebAuthenticationDetail.UserCredential.Key = getProperty("key"); request.WebAuthenticationDetail.UserCredential.Password = getProperty("password"); } // request.ClientDetail = new ClientDetail(); request.ClientDetail.AccountNumber = "XXX"; // Replace "XXX" with the client's account number request.ClientDetail.MeterNumber = "XXX"; // Replace "XXX" with the client's meter number if (usePropertyFile()) //Set values from a file for testing purposes { request.ClientDetail.AccountNumber = getProperty("accountnumber"); request.ClientDetail.MeterNumber = getProperty("meternumber"); } // request.TransactionDetail = new TransactionDetail(); request.TransactionDetail.CustomerTransactionId = "***Validate Postal Service Request using VC#***"; // The client will get the same value back in the response // request.Version = new VersionId(); // Creates the Version element with all child elements populated from the wsdl // request.CarrierCode = CarrierCodeType.FDXE; request.CarrierCodeSpecified = true; request.Address = new Address(); request.Address.PostalCode = "32810"; request.Address.CountryCode = "US"; return(request); }