---
title: Architecture
summary: How the proxy is constructed, configured, invoked, and disposed.
status: draft
owner: SAIF.Core documentation
last_reviewed: 2026-09-24
---

# Architecture

This repository reaches `WSLogging` through the generated `clsWSLoggingSoapClient`, wrapped by the authored `LoggingServiceProxy`, which builds a default `BasicHttpBinding` and `EndpointAddress` in code rather than relying on the `app.config` endpoint.

## Proxy mechanism

| Aspect | Finding |
| --- | --- |
| Mechanism | Service Reference (svcutil) |
| Proxy type | `SAIF.Services.Web.Proxies.Logging.clsWSLoggingSoapClient` (`internal`) |
| Base type | `System.ServiceModel.ClientBase<T>` |
| Contract type | `internal interface clsWSLoggingSoap` |
| Constructed in | `SAIFExceptionLogger.Log` (`Services/SAIF.Services.WebApi/EnvironmentApi/App_Start/SAIFExceptionLogger.cs:20`) |
| Binding configured in | Code |
| Address supplied by | Constructor argument (`serviceUrl`), itself sourced from `ConfigurationManager.AppSettings["loggingServiceUrl"]` |

## Architecture diagram

The following diagram visualizes how a call reaches the remote service.

```mermaid
flowchart TD
    CALLER["SAIFExceptionLogger.Log"] --> WRAP["LoggingServiceProxy<br>hand-written wrapper"]
    WRAP --> BIND["Binding constructed<br>BasicHttpBinding (defaults)"]
    BIND --> ADDR["EndpointAddress<br>from appSettings loggingServiceUrl"]
    ADDR --> PROXY["clsWSLoggingSoapClient<br>generated proxy"]
    PROXY --> REMOTE["Remote service<br>WSLogging (ASMX)"]
```

The wrapper is never disposed at its only call site, so no disposal node is drawn — see [Consumption](consumption.md).

## Hand-written wrapper

| Field | Value |
| --- | --- |
| **Type** | `SAIF.Services.Web.Proxies.LoggingServiceProxy` |
| **Source** | `Services/SAIF.Services.Web.Proxies/LoggingServiceProxy.cs` |
| **Visibility** | `public` |
| **Implements** | `IDisposable` |
| **Responsibility** | Validates the supplied service URL, constructs the generated `clsWSLoggingSoapClient` with an explicit binding and address, and exposes `LogException` |
| **Proxy lifetime** | Per call — a new `LoggingServiceProxy` is constructed inside `SAIFExceptionLogger.Log` for each logged exception |

| Configuration applied | Value | Source |
| --- | --- | --- |
| `BasicHttpBinding` security mode | None declared — `BasicHttpBinding()` defaults*, so `BasicHttpSecurityMode.None` applies | `LoggingServiceProxy.cs:18` |
| Transport client credential | None set | `LoggingServiceProxy.cs:17-20` |
| `MaxReceivedMessageSize` | Not set — the WCF default of 65,536 bytes applies* | `LoggingServiceProxy.cs:17-20` |
| `MaxBufferSize` | Not set — WCF default applies* | `LoggingServiceProxy.cs:17-20` |
| Timeouts | None set — binding defaults apply* | `LoggingServiceProxy.cs:17-20` |

## Endpoint resolution

| Environment | Address | Resolved from | Changeable without a rebuild |
| --- | --- | --- | --- |
| All (no per-build transform) | `http://saifonline/WebServices/WSLogging/clsWSLogging.asmx` | `Services/SAIF.Services.WebApi/EnvironmentApi/Web.config:8` | Yes — an `appSettings` value, but neither `Web.Debug.config` nor `Web.Release.config` overrides it, so the production host is used in every build configuration |

Separately, `environments.xml` defines a per-track `loggingServiceUrl` (`webdev01`, `webdev02`, `webtest01`, `webtest02`, `webqa`, `saifonline`) that `EnvironmentApi` serves to *other* applications; `SAIFExceptionLogger` does not read that data and always uses the `Web.config` value.

## Lifetime and disposal

| Aspect | Finding |
| --- | --- |
| Proxy lifetime | Per call |
| Disposal | **None.** No `using`, no `Close()`, and no `Abort()` are called on the `LoggingServiceProxy` at its only call site |
| Faulted-channel handling | Not applicable — the instance is never disposed |
| Thread safety | Not determined from source |

## Integration points

| System | Type | Purpose |
| --- | --- | --- |
| `WSLogging` | SOAP service | Records error entries for later retrieval |

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

> **Note:** 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.WebApi/EnvironmentApi/Web.config`
