Skip to content

AddressSearchService

Implements IAddressSearchService, wrapping the CorrectAddress (USPS) clsCAServices.FindCityStateInfoByZip web-service call to resolve city/state/county combinations for a given ZIP code. It extends CleanAddressServiceBase for shared proxy configuration and disposal, and manually parses the fixed-width, 55-character-per-row result string the vendor service returns into a collection of ICleanedCityStateCounty contract objects.

Purpose

  • Looks up all valid city/state/county combinations for a ZIP code via the CorrectAddress web service.
  • Parses the vendor's fixed-width result buffer into strongly typed ICleanedCityStateCounty records.

Context

  • Namespace: SAIF.Services.Utilities.CleanAddress
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package)

Public members

Member Signature Purpose
AddressSearchService(...) public AddressSearchService(clsCAServices service) Wires the CorrectAddress SOAP proxy into the shared base class, applying its default connection settings.
FindCityStateByZip public Collection<ICleanedCityStateCounty> FindCityStateByZip(string zip) Calls the CorrectAddress service for the ZIP code and returns each candidate city/state/county row parsed from the fixed-width response buffer.
Dispose() public void Dispose() Releases the underlying clsCAServices proxy connection (inherited from CleanAddressServiceBase).

Behavioral notes

  • Allocates a 2,750-character (50 * 55) buffer up front and reads back outResultsCount rows of 55 characters each, splitting City (28 chars), State (2 chars), and County (25 chars) by fixed offsets — a format change on the vendor side would silently corrupt parsed results*.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Services/SAIF.Services/Utilities/CleanAddress/AddressSearchService.cs