PAVv3 CSharp

From CDYNE Wiki
Jump to: navigation, search

Using as a Service Reference(.NET Framework 3.5+)

Add a service reference to your project: http://pav3.cdyne.com/PavService.svc?wsdl


Contents

Get Congressional District By Zip

/*http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL*/
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GetCongressionalDistrictByZip.WSDL;
 
namespace GetCongressionalDistrictByZip
{
class Program
{
static void Main(string[] args)
{
WSDL.PavServiceClient PSC = new WSDL.PavServiceClient("pavsoap");
WSDL.CongressionalDistrictResponse CDR = new WSDL.CongressionalDistrictResponse();
 
CDR = PSC.GetCongressionalDistrictByZip("23320", "YOUR LICENSE KEY");
 
if (CDR.ReturnCode == 0)
Console.WriteLine("Congressional District Found: " + CDR.CongressionalDistrict);
 
else if (CDR.ReturnCode == 1)
Console.WriteLine("Invalid input.");
 
else if (CDR.ReturnCode == 2)
Console.WriteLine("Invalid license key.");
 
else if (CDR.ReturnCode == 3)
Console.WriteLine("Congressional District not found.");
 
else if (CDR.ReturnCode == 4)
{
Console.WriteLine("Multiple Congressional Districts Found:" + "\n");
 
foreach (Char CongressionalDistrict in CDR.CongressionalDistrict)
{
Console.WriteLine(CDR.CongressionalDistrict);
}
}
Console.ReadLine();
}
}
}

Get City Names For Zip Code

/*http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL*/
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GetCityNamesForZipCode.WSDL;
 
namespace GetCityNamesForZipCode
{
class Program
{
static void Main(string[] args)
{
WSDL.PavServiceClient PSC = new WSDL.PavServiceClient("pavsoap");
WSDL.CityNamesResponse CNR = new WSDL.CityNamesResponse();
 
CNR = PSC.GetCityNamesForZipCode("23320", "YOUR LICENSE KEY");
 
if (CNR.ReturnCode == 0)
{
Console.WriteLine("City Name: " + "\n");
 
foreach (WSDL.City city in CNR.CityNames)
{
Console.WriteLine(city.Name);
}
}
else if (CNR.ReturnCode == 1)
Console.WriteLine("Invalid input.");
 
else if (CNR.ReturnCode == 2)
Console.WriteLine("Invalid license key.");
 
else if (CNR.ReturnCode == 3)
Console.WriteLine("No match found.");
 
Console.ReadLine();
}
}
}

Get Zip Codes For City And State

/*http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL*/
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GetZipCodesForCityAndState.WSDL;
 
namespace GetZipCodesForCityAndState
{
class Program
{
static void Main(string[] args)
{
WSDL.PavServiceClient PSC = new WSDL.PavServiceClient("pavsoap");
WSDL.ZipCodesResponse ZCR = new WSDL.ZipCodesResponse();
 
ZCR = PSC.GetZipCodesForCityAndState("Chesapeake", "VA", "YOUR LICENSE KEY");
 
if (ZCR.ReturnCode == 0)
{
Console.WriteLine("Zip Code(s) Found: " + "\n");
 
foreach (string Zip in ZCR.ZipCodes)
{
Console.WriteLine(Zip);
}
}
else if (ZCR.ReturnCode == 1)
Console.WriteLine("Invalid input.");
 
else if (ZCR.ReturnCode == 2)
Console.WriteLine("Invalid license key.");
 
else if (ZCR.ReturnCode == 3)
Console.WriteLine("No match found.");
 
Console.ReadLine();
}
}
}

Get Urbanization List For ZipCode

/*http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL*/
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GetUrbanizationListForZipCode.WSDL;
 
namespace GetUrbanizationListForZipCode
{
class Program
{
static void Main(string[] args)
{
WSDL.PavServiceClient PSC = new PavServiceClient("pavsoap");
WSDL.UrbanizationResponse UR = new WSDL.UrbanizationResponse();
 
UR = PSC.GetUrbanizationListForZipCode("23320", "YOUR LICENSE KEY");
 
if (UR.ReturnCode == 0)
{
Console.WriteLine("Urbanization Names Found: " + "\n");
 
foreach (string Urban in UR.UrbanizationList)
{
Console.WriteLine(Urban);
}
}
else if (UR.ReturnCode == 1)
Console.WriteLine("Invalid input.");
 
else if (UR.ReturnCode == 2)
Console.WriteLine("Invalid license key.");
 
else if (UR.ReturnCode == 3)
Console.WriteLine("No match found.");
 
Console.ReadLine();
}
}
}

Verify Address Advanced

/*http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL*/
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VerifyAddressAdvanced.WSDL;
 
namespace VerifyAddressAdvanced
{
class Program
{
static void Main(string[] args)
{
WSDL.PavServiceClient PSC = new WSDL.PavServiceClient("pavsoap");
WSDL.PavRequest PR = new WSDL.PavRequest();
 
PR.LicenseKey = "YOUR LICENSE KEY";
PR.FirmOrRecipient = "CDYNE Corporation";
PR.PrimaryAddressLine = "505 Independence Parkway";
PR.SecondaryAddressLine = "Suite 300";
PR.CityName = "Chesapeake";
PR.State = "VA";
PR.ZipCode = "23320";
PR.Urbanization = "";
PR.ReturnCaseSensitive = true;
PR.ReturnCensusInfo = true;
PR.ReturnCityAbbreviation = true;
PR.ReturnGeoLocation = true;
PR.ReturnLegislativeInfo = true;
PR.ReturnMailingIndustryInfo = true;
PR.ReturnResidentialIndicator = true;
PR.ReturnStreetAbbreviated = true;
 
WSDL.PavResponse PavRes = new WSDL.PavResponse();
PavRes = PSC.VerifyAddressAdvanced(PR);
 
/* The return section below will output the return code with the return code text along with the address information.
To view a list of all possible return codes: http://wiki.cdyne.com/index.php/PAVv3_Return_Codes*/

 
if (PavRes.ReturnCode == 100)
 
Console.WriteLine(
"Return Code: " + PavRes.ReturnCode + " - Input address is DPV confirmed for all components." + "\n" +
PavRes.FirmOrRecipient + "\n" +
PavRes.PrimaryDeliveryLine + "\n" +
PavRes.CityName + ", " +
PavRes.StateAbbreviation + " " +
PavRes.ZipCode + "\n" +
PavRes.Country);
 
else Console.WriteLine(
"Return Code: " + PavRes.ReturnCode + "\n" +
PavRes.FirmOrRecipient + "\n" +
PavRes.PrimaryDeliveryLine + "\n" +
PavRes.CityName + ", " +
PavRes.StateAbbreviation + " " +
PavRes.ZipCode + "\n" +
PavRes.Country);
 
Console.ReadLine();
}
}
}
 
/*
Additional Return Fields:
 
PavRes.CensusInfo
PavRes.GeoLocationInfo
PavRes.LegislativeInfo
PavRes.MailingIndustryInfo
PavRes.MultipleMatches
PavRes.ResidentialDeliveryIndicator
PavRes.County
PavRes.CountyNum
PavRes.FinanceNumber
PavRes.IntelligentMailBarcodeKey
PavRes.PMBDesignator
PavRes.PMBNumber
PavRes.PostDirectional
PavRes.PostnetBarcode
PavRes.PreDirectional
PavRes.PreferredCityName
PavRes.Primary
PavRes.PrimaryEO
PavRes.PrimaryHigh
PavRes.PrimaryLow
PavRes.ReturnCodeSpecified
PavRes.Secondary
PavRes.SecondaryAbbreviation
PavRes.SecondaryEO
PavRes.SecondaryHigh
PavRes.SecondaryLow
PavRes.StreetName
PavRes.Suffix
PavRes.Urbanization
*/

Verify Address

/*http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL*/
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VerifyAddress.WSDL;
 
namespace VerifyAddress
{
class Program
{
static void Main(string[] args)
{
WSDL.PavServiceClient PSC = new WSDL.PavServiceClient("pavsoap");
WSDL.Address Res = new WSDL.Address();
 
Res = PSC.VerifyAddress("CDYNE Corporation", "505 Independence Parkway", "Suite 300", "", "Chesapeake", "VA", "", "YOUR LICENSE KEY");
 
/* The return section below will output the return code with the return code text along with the address information.
To view a list of all possible return codes: http://wiki.cdyne.com/index.php/PAVv3_Return_Codes*/

 
if (Res.ReturnCode == 100)
 
Console.WriteLine(
"Return Code: " + Res.ReturnCode + " - Input address is DPV confirmed for all components." + "\n" +
Res.FirmNameOrRecipient + "\n" +
Res.PrimaryAddressLine + "\n" +
Res.CityName + ", " +
Res.StateAbbreviation + " " +
Res.ZipCode + "\n" +
Res.Country);
 
else
Console.WriteLine(
"Return Code: " + Res.ReturnCode + "\n" +
Res.FirmNameOrRecipient + "\n" +
Res.PrimaryAddressLine + "\n" +
Res.CityName + ", " +
Res.StateAbbreviation + " " +
Res.ZipCode + "\n" +
Res.Country);
Console.ReadLine();
}
}
}
 
/*
Additional Return Fields:
 
Res.County
Res.Urbanization
*/

Get Intelligent Mail Barcode

/*http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL*/
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GetIntelligentMailBarcode.WSDL;
 
namespace GetIntelligentMailBarcode
{
class Program
{
static void Main(string[] args)
{
WSDL.PavServiceClient PSC = new WSDL.PavServiceClient("pavsoap");
WSDL.IntelligentBarcodeResponse IMB = new WSDL.IntelligentBarcodeResponse();
 
IMB = PSC.GetIntelligentMailBarcode("12", "123", "123456", "123456789", "dw/cKC9h9Au0zJy+WGvQkQ==", "YOUR LICENSE KEY");
 
if (IMB.ReturnCode == 0)
Console.WriteLine("Intelligent Mail Barcode: " + IMB.Barcode);
 
else if (IMB.ReturnCode == 1)
Console.WriteLine("Invalid input.");
 
Console.ReadLine();
}
}
}

Get Zip Codes For Fips

/*http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL*/
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GetZipCodesForFips.WSDL;
 
namespace GetZipCodesForFips
{
class Program
{
static void Main(string[] args)
{
WSDL.PavServiceClient PSC = new PavServiceClient("pavsoap");
WSDL.ZipCodesResponse ZCR = new ZipCodesResponse();
 
ZCR = PSC.GetZipCodesForFips("51550", "YOUR LICENSE KEY");
 
if (ZCR.ReturnCode == 0)
{
Console.WriteLine("Zip Codes(s) Found: " + "\n");
 
foreach (string Zip in ZCR.ZipCodes)
{
Console.WriteLine(Zip);
}
}
else if (ZCR.ReturnCode == 1)
Console.WriteLine("Invalid input.");
 
else if (ZCR.ReturnCode == 2)
Console.WriteLine("Invalid license key.");
 
else if (ZCR.ReturnCode == 3)
Console.WriteLine("No zip codes found.");
 
Console.ReadLine();
}
}
}

Get Zip Codes Within Distance

/*http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL*/
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GetZipCodesWithinDistance.WSDL;
 
namespace GetZipCodesWithinDistance
{
class Program
{
static void Main(string[] args)
{
WSDL.PavServiceClient PSC = new WSDL.PavServiceClient("pavsoap");
WSDL.ZipCodesResponse ZCR = new WSDL.ZipCodesResponse();
 
ZCR = PSC.GetZipCodesWithinDistance("36.761560", "-76.259964", "5", "YOUR LICENSE KEY");
 
if (ZCR.ReturnCode == 0)
{
Console.WriteLine("Zip code(s) found:" + "\n");
 
foreach (string Zip in ZCR.ZipCodes)
{
Console.WriteLine(Zip);
}
}
else if (ZCR.ReturnCode == 1)
Console.WriteLine("Invalid input.");
 
else if (ZCR.ReturnCode == 2)
Console.WriteLine("Invalid license key.");
 
else if (ZCR.ReturnCode == 3)
Console.WriteLine("No match found.");
 
else if (ZCR.ReturnCode == 4)
Console.WriteLine("Outside of Latitude/Longitude range.");
 
Console.ReadLine();
}
}
}

Back to Postal_Address_Verification_V3

Personal tools
Namespaces

Variants
Actions
Navigation
Tools

Trial Key