---
title: Consumption
summary: How a consuming application references, constructs, calls, and disposes the proxy.
status: draft
owner: SAIF.Core documentation
last_reviewed: 2026-09-24
---

# Consumption

`CleanAddressSvc` reaches its consumers indirectly: [`SAIF.Services`](../../libraries/saif-services/overview.md) — the class library that carries the reference and ships in the `SAIF.SAIFCode.Core` NuGet package — exposes three public adapter types over the proxy, but no production code in this repository constructs the adapters or the proxy itself.

## Reference style

| Field | Value |
| --- | --- |
| Mechanism | Web Reference (wsdl.exe) |
| Declared in | `Services/SAIF.Services/SAIF.Services.csproj:531-541` |
| Generated artifacts | `Services/SAIF.Services/Web References/CleanAddressSvc/Reference.cs`, `Reference.map`, `clsCAServices.wsdl`, `clsCAServices.disco` |
| Target framework | .NET Framework 4.6.2 |
| Regeneration command | Visual Studio "Update Web Reference" |

## Construction

```csharp
// Tests/SAIF.Services.Tests/Utilities/WhenCleansingAddress.cs:27,40 (test-only construction)
new CleanAddressService(new CleanAddressSvc.clsCAServices());
```

| Step | Requirement |
| --- | --- |
| Endpoint address | Generated setting `SAIF.Services.Properties.Settings.Default.SAIF_Services_CleanAddressSvc_clsCAServices`, assigned in the generated constructor |
| Binding | ASMX transport defaults |
| Credentials | `UseDefaultCredentials = true` (ambient Windows identity), set by `CleanAddressServiceBase` |
| Initialization | Single-constructor: the proxy instance is passed into the adapter's constructor, guarded with `Enforce.ArgumentNotNull` |

## Endpoint configuration

| Setting | Value | Source | Changeable without a rebuild |
| --- | --- | --- | --- |
| Endpoint address | `http://correctaddress/wsCorrectAddress/clsCAServices.asmx` | `Services/SAIF.Services/Properties/Settings.Designer.cs:29` (compiled default) | No — this repository's own `app.config` is not loaded by a consuming host; an override requires the host to redeclare `applicationSettings/SAIF.Services.Properties.Settings/SAIF_Services_CleanAddressSvc_clsCAServices`* |
| Binding configuration | ASMX transport defaults | — | Not applicable |
| Security mode | Plain HTTP with Windows default credentials | `Services/SAIF.Services/Utilities/CleanAddress/CleanAddressServiceBase.cs:20-21` | No — hard-coded in the wrapper |

## Resilience

| Concern | Finding | Configurable by consumer | Source | Tech debt |
| --- | --- | --- | --- | --- |
| Timeout | None configured — `WebClientProtocol` default of 100,000 ms applies* | No | — | Yes |
| Retry | None configured | No | — | Yes |
| Circuit breaking | None configured | No | — | Yes |
| Thread safety | Not determined from source | — | — | No |
| Cancellation | Not supported — no cancellation on any call site | — | — | Yes |
| Message size limits | None set — ASMX transport defaults apply | No | — | No |

Every call site is synchronous with no retry, timeout, or cancellation configured. A consumer that needs to bound the call latency or recover from a transient failure must wrap the adapter itself; nothing in `SAIF.Services` provides that. Cross-reference [Tech debt](tech-debt.md) findings TD-CA-02 and TD-CA-03.

## Disposal

| Aspect | Finding |
| --- | --- |
| Disposal performed | `Dispose()` on `CleanAddressServiceBase` |
| Faulted channel handled | Not applicable — ASMX proxies do not have WCF channel faults |
| Wrapper responsibility | `CleanAddressServiceBase` disposes the injected proxy |
| Source | `Services/SAIF.Services/Utilities/CleanAddress/CleanAddressServiceBase.cs:26-39` |

```csharp
// CleanAddressServiceBase.cs:26-39 (paraphrased structure, see source for exact IDisposable pattern)
protected virtual void Dispose(bool disposing)
{
    if (disposing)
    {
        UspsService.Dispose();
    }
}
```

## Error handling for consumers

| Failure | Surfaces as | Consumer action |
| --- | --- | --- |
| Service unreachable | `WebException`† | Not handled at any call site except `CleanAddress`, which swallows it |
| SOAP fault returned | `SoapException`† | Not handled at any call site except `CleanAddress`, which swallows it |
| Timeout exceeded | `WebException`† | Not handled |
| Response larger than the message size limit | `WebException`† | Not handled |
| Empty or absent output message | `NullReferenceException` on `.Trim()` in `ConvertToProperCase`* | Not handled |

## Usage examples

```csharp
// Tests/SAIF.Services.Tests/Utilities/WhenCleansingAddress.cs:27,40
var service = new CleanAddressService(new CleanAddressSvc.clsCAServices());
var result = service.CleanAddress(addressLine1, addressLine2, city, state, zip, zip4, mixedCase: true);
```

| Scenario | Operations used | Notes |
| --- | --- | --- |
| Live-network unit test | `CleanAddress`, `ConvertToProperCase` | Constructs the real proxy and calls the live endpoint (`WhenCleansingAddress.cs:7-8,30,42`) |
| Live-network unit test | `FindCityStateInfoByZip` | Constructs the real proxy (`WhenSearchingAddress.cs:15`) |

## Lifecycle guidance

| Question | Answer |
| --- | --- |
| Construct once or per call | Not determined from source — the only construction found is per test |
| Disposable | Yes (`IDisposable` via `CleanAddressServiceBase`) |
| Safe to share across threads | Not determined from source |

## Related documentation
- [Client index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Contract](contract.md)
- [Operation map](operation-map.md)
- [Client reference](reference.md)
- [Dependencies](dependencies.md)
- [Business rules](business-rules.md)
- [Tech debt](tech-debt.md)

> **Note:** Statements marked with `†` are derived from dependency library
> documentation via the Legends CLI. Statements marked with `*` were inferred
> from code structure or contextual evidence.

## Sources
- `Services/SAIF.Services/Utilities/CleanAddress/CleanAddressServiceBase.cs`
- `Services/SAIF.Services/Utilities/CleanAddress/CleanAddressService.cs`
- `Services/SAIF.Services/Properties/Settings.Designer.cs`
- `Tests/SAIF.Services.Tests/Utilities/WhenCleansingAddress.cs`
- `Tests/SAIF.Services.Tests/Utilities/WhenSearchingAddress.cs`
