---
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

A consumer must construct the authored `PdfServiceProxy` wrapper directly, supplying its own service URL and database environment; no repository code in this repository currently does so. `SAIF.Services.Web.Proxies`, the library that carries this proxy, is itself consumed as a library within this run — see [`saif-services-web-proxies`](../../libraries/saif-services-web-proxies/overview.md).

## Reference style

| Field | Value |
| --- | --- |
| Mechanism | Service Reference (svcutil) |
| Declared in | `Services/SAIF.Services.Web.Proxies/SAIF.Services.Web.Proxies.csproj` |
| Generated artifacts | `Services/SAIF.Services.Web.Proxies/Service References/PDFService/` |
| Target framework | .NET Framework 4.6.2 |
| Regeneration command | Visual Studio "Update Service Reference" |

## Construction

```csharp
var binding = new BasicHttpBinding
{
    MaxReceivedMessageSize = int.MaxValue,
    ReaderQuotas = new XmlDictionaryReaderQuotas { MaxArrayLength = int.MaxValue }
};
var client = new PDFServiceClient(binding, new EndpointAddress(serviceUrl));
```

| Step | Requirement |
| --- | --- |
| Endpoint address | Supplied by the caller of `PdfServiceProxy`'s constructor (`serviceUrl` argument); no repository source supplies one |
| Binding | Constructed in code (`BasicHttpBinding` with unbounded message size and array length) |
| Credentials | None |
| Initialization | Single-constructor — `PdfServiceProxy(serviceUrl, database)` |

## Endpoint configuration

| Setting | Value | Source | Changeable without a rebuild |
| --- | --- | --- | --- |
| Endpoint address | Unresolved** — caller-supplied `serviceUrl` | `PDFServiceProxy.cs:14-27` | Yes — it is a constructor argument, not a literal |
| Binding configuration | Constructed in code | `PDFServiceProxy.cs:20-24` | No — changing binding settings requires a rebuild |
| Security mode | `None` (default) | `PDFServiceProxy.cs:20-24` | No |

## Resilience

| Concern | Finding | Configurable by consumer | Source | Tech debt |
| --- | --- | --- | --- | --- |
| Timeout | None configured — binding defaults apply | No | `PDFServiceProxy.cs:20-24` | Yes |
| Retry | None configured (client-side) | No | — | Yes |
| Circuit breaking | None configured | No | — | Yes |
| Thread safety | Not determined from source | — | — | No |
| Cancellation | Not supported — no cancellation on the call site | — | `PDFServiceProxy.cs:42` | Yes |
| Message size limits | `MaxReceivedMessageSize = int.MaxValue`, `MaxArrayLength = int.MaxValue` — effectively unbounded | No | `PDFServiceProxy.cs:22-23` | Yes |

There is no client-side retry, so a transient failure fails the single attempt outright; a consumer wrapping this proxy must add its own retry policy. There is no explicit timeout, so the call relies on the `BasicHttpBinding` framework defaults (1-minute send timeout); a consumer that needs a shorter or longer bound must set it explicitly. See [Tech debt](tech-debt.md) for the unbounded message-size finding.

## Disposal

| Aspect | Finding |
| --- | --- |
| Disposal performed | `Close()` only |
| Faulted channel handled | No — a faulted channel throws from `Close()` and masks the original failure* |
| Wrapper responsibility | `PdfServiceProxy` disposes the generated client |
| Source | `Services/SAIF.Services.Web.Proxies/PDFServiceProxy.cs:59-67` |

```csharp
public void Dispose()
{
    _client.Close();
}
```

## Error handling for consumers

| Failure | Surfaces as | Consumer action |
| --- | --- | --- |
| Service unreachable | `EndpointNotFoundException`* | Not handled by the wrapper — propagates to the consumer |
| SOAP fault returned | `FaultException`* | Not handled by the wrapper — propagates to the consumer |
| Timeout exceeded | `TimeoutException`* | Not handled by the wrapper — propagates to the consumer |
| Response larger than the message size limit | Not applicable — limits are effectively unbounded | — |
| Empty or absent output message | `NullReferenceException` on `result.File` if `result` is null* | Not handled — no null check |

## Usage examples

No repository source constructs or calls `PdfServiceProxy`, so no in-repository usage example can be drawn from source. The example below is hypothetical and illustrative only — it is not drawn from any call site in this repository — and models the construct, call, and dispose sequence a future consumer would need, based on `PdfServiceProxy`'s actual constructor and `GetImage` signatures and its `Dispose` pattern*.

```csharp
// Hypothetical example — no repository source currently constructs or calls PdfServiceProxy*
using (var proxy = new PdfServiceProxy(serviceUrl: "http://webdev01/WebServices/WCFHost/PDFService.svc", database: "DEV"))
{
    byte[] imageBytes = proxy.GetImage(imageSeqNum: 123456, maxWaitTimeInSeconds: 10);
    // imageBytes is the cached document image, or null if the remote service reported a failure*
}
```

| Scenario | Operations used | Notes |
| --- | --- | --- |
| Retrieve a cached document image by sequence number (hypothetical)* | `LoadCache` | The `using` block relies on `PdfServiceProxy.Dispose()` to close the underlying `PDFServiceClient`; no repository source performs this sequence today* |

## Lifecycle guidance

| Question | Answer |
| --- | --- |
| Construct once or per call | Not determined from source — no in-repository caller exists |
| Disposable | Yes (`IDisposable`) |
| 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)
- [Tech debt](tech-debt.md)

> **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.Web.Proxies/PDFServiceProxy.cs`
- `Services/SAIF.Services.Web.Proxies/app.config`
- `Services/SAIF.Services.Web.Proxies/SAIF.Services.Web.Proxies.csproj`
