---
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 obtains error logging by constructing a new `LoggingServiceProxy` per logged exception inside `EnvironmentApi.SAIFExceptionLogger`, part of `SAIF.Services.Web.Proxies` as documented at [`SAIF.Services.Web.Proxies` overview](../../libraries/saif-services-web-proxies/overview.md); `EnvironmentApi` reaches that library through a binary `HintPath` reference rather than a project reference.

## Reference style

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

## Construction

```csharp
public LoggingServiceProxy(string serviceUrl)
{
    Enforce.ArgumentNotNullOrWhiteSpace(serviceUrl, nameof(serviceUrl));
    webService = new clsWSLoggingSoapClient(new BasicHttpBinding(), new EndpointAddress(serviceUrl));
}
```

| Step | Requirement |
| --- | --- |
| Endpoint address | Constructor argument, resolved by `SAIFExceptionLogger` from `ConfigurationManager.AppSettings["loggingServiceUrl"]` |
| Binding | Constructed in code — `new BasicHttpBinding()` with all defaults |
| Credentials | None |
| Initialization | Single-constructor |

## Endpoint configuration

| Setting | Value | Source | Changeable without a rebuild |
| --- | --- | --- | --- |
| Endpoint address | `http://saifonline/WebServices/WSLogging/clsWSLogging.asmx` | `Services/SAIF.Services.WebApi/EnvironmentApi/Web.config:8` | Yes — an `appSettings` value, but no build transform overrides it, so the production host is used in every build |
| Binding configuration | Constructed in code | `Services/SAIF.Services.Web.Proxies/LoggingServiceProxy.cs:17-20` | No |
| Security mode | None declared — `BasicHttpBinding()` default* | `LoggingServiceProxy.cs:18` | No |

The `app.config` `<client><endpoint name="clsWSLoggingSoap">` entry (`Services/SAIF.Services.Web.Proxies/app.config:54`, address `webdev01`) is present but is not used at runtime, because the wrapper supplies an explicit `Binding` and `EndpointAddress` to the generated constructor.

## Resilience

| Concern | Finding | Configurable by consumer | Source | Tech debt |
| --- | --- | --- | --- | --- |
| Timeout | None configured — binding defaults apply | No | `LoggingServiceProxy.cs:17-20` | 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 | — | `LoggingServiceProxy.cs:26` | Yes |
| Message size limits | Not set — WCF default of 65,536 bytes applies* | No | `LoggingServiceProxy.cs:17-20` | No |

The call runs synchronously inside `ExceptionLogger.Log`, so a slow or unreachable logging host blocks the request thread for up to the default one-minute send timeout*.

## Disposal

| Aspect | Finding |
| --- | --- |
| Disposal performed | **None.** No `using`, `Close()`, or `Abort()` at the only call site |
| Faulted channel handled | Not applicable — the instance is never disposed |
| Wrapper responsibility | Neither the wrapper nor the call site disposes the proxy |
| Source | `Services/SAIF.Services.WebApi/EnvironmentApi/App_Start/SAIFExceptionLogger.cs:20` |

```csharp
// LoggingServiceProxy implements IDisposable, calling Dispose() -> Close(), but this
// call site never invokes it:
var loggingProxy = new LoggingServiceProxy(serviceUrl);
loggingProxy.LogException(detail);
```

## Error handling for consumers

| Failure | Surfaces as | Consumer action |
| --- | --- | --- |
| Service unreachable | `EndpointNotFoundException`† | Swallowed by the bare `catch { }` in `SAIFExceptionLogger.Log`, which falls back to `Trace.TraceError` |
| SOAP fault returned | `FaultException`† | Same — swallowed and traced |
| Timeout exceeded | `TimeoutException`† | Same — swallowed and traced |
| Response larger than the message size limit | Not applicable — the response is empty | — |
| Empty or absent output message | Not applicable — `WriteError` is one-way | — |

Catching every exception here appears intended to prevent a logging failure from crashing the request being logged*, but the logging-service failure itself is swallowed without any record, so an operator has no signal that error logging has stopped working.

## Usage examples

```csharp
// Log an unhandled Web API exception
var loggingProxy = new LoggingServiceProxy(ConfigurationManager.AppSettings["loggingServiceUrl"]);
loggingProxy.LogException(new ApplicationExceptionDetail
{
    Application = "EnvironmentApi",
    Environment = "NetProd",
    ExceptionDate = DateTime.Now,
    Message = exception.GetErrorLogFormattedException()
});
```

| Scenario | Operations used | Notes |
| --- | --- | --- |
| Record an unhandled Web API exception | `WriteError` | Called once per exception from `SAIFExceptionLogger.Log` |

## Lifecycle guidance

| Question | Answer |
| --- | --- |
| Construct once or per call | Per call — a new `LoggingServiceProxy` is created for each logged exception |
| Disposable | Yes (`IDisposable`), but never disposed at the only call site |
| 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.Web.Proxies/LoggingServiceProxy.cs`
- `Services/SAIF.Services.WebApi/EnvironmentApi/App_Start/SAIFExceptionLogger.cs`
- `Services/SAIF.Services.Web.Proxies/app.config`
- `Services/SAIF.Services.WebApi/EnvironmentApi/Web.config`
- `Services/SAIF.Services.Web.Proxies/Service References/Logging/Reference.svcmap`
