---
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 `SAIFDates`† only through the authored `WorkCalendarServiceProxy` wrapper, which builds a default `BasicHttpBinding()` in code and passes a caller-supplied URL to the generated, `internal` `SAIFDatesSoapClient`; no repository source constructs `WorkCalendarServiceProxy` itself.

## Proxy mechanism

| Aspect | Finding |
| --- | --- |
| Mechanism | Service Reference (svcutil) |
| Proxy type | `SAIFDatesSoapClient` (`internal`) |
| Base type | `System.ServiceModel.ClientBase<T>` |
| Contract type | `internal interface SAIFDatesSoap` |
| Constructed in | `WorkCalendarServiceProxy` constructor (`Services/SAIF.Services.Web.Proxies/WorkCalendarServiceProxy.cs:12-19`) — the wrapper itself has no in-repository caller |
| Binding configured in | Code — `new BasicHttpBinding()` with every default |
| Address supplied by | Constructor argument (`serviceUrl`) passed to `WorkCalendarServiceProxy`; the generated `<client><endpoint>` in `app.config` is bypassed |

## Architecture diagram

The following diagram visualizes how a call would reach the remote service if `WorkCalendarServiceProxy` were constructed and called.

```mermaid
flowchart TD
    CALLER["Caller of<br>WorkCalendarServiceProxy methods<br>(none found in this repository)"] --> WRAP["WorkCalendarServiceProxy<br>hand-written wrapper"]
    WRAP --> BIND["BasicHttpBinding()<br>all defaults (65536 byte limit)"]
    BIND --> ADDR["EndpointAddress<br>from caller-supplied serviceUrl"]
    ADDR --> PROXY["SAIFDatesSoapClient<br>generated proxy (internal)"]
    PROXY --> REMOTE["SAIFDates<br>remote ASMX service"]
    WRAP --> DISPOSE["Close() only<br>on Dispose()"]
```

## Hand-written wrapper

| Field | Value |
| --- | --- |
| **Type** | `WorkCalendarServiceProxy` |
| **Source** | `Services/SAIF.Services.Web.Proxies/WorkCalendarServiceProxy.cs` |
| **Visibility** | `public` |
| **Implements** | `IDisposable` |
| **Responsibility** | Builds the binding and endpoint address, constructs the generated client, and passes each of the four operations through unchanged |
| **Proxy lifetime** | Per `WorkCalendarServiceProxy` instance |

| Configuration applied | Value | Source |
| --- | --- | --- |
| `BasicHttpBinding` security mode | `None` (default — not set explicitly) | `WorkCalendarServiceProxy.cs:16-19` |
| Transport client credential | None configured | `WorkCalendarServiceProxy.cs:16-19` |
| `MaxReceivedMessageSize` | `65536` (default — not raised) | `WorkCalendarServiceProxy.cs:16-19` |
| `MaxBufferSize` | Not set — binding default applies | — |
| Timeouts | None set — binding defaults apply | `WorkCalendarServiceProxy.cs:16-19` |

## Endpoint resolution

| Environment | Address | Resolved from | Changeable without a rebuild |
| --- | --- | --- | --- |
| All | Unresolved** — the `serviceUrl` constructor argument, supplied by whoever constructs `WorkCalendarServiceProxy`; no repository source does so | `WorkCalendarServiceProxy.cs:12-19` | Yes — the address is a constructor argument, not a compiled-in literal, but no caller exists in this repository to change it |

The candidate environment key `workCalendarServiceUrl` resolves to the same address (`http://saifonline/webservices/SAIFDates/saifdates.asmx`) on every track in `environments.xml`, but nothing in this repository reads it and passes it to `WorkCalendarServiceProxy`.

## Lifetime and disposal

| Aspect | Finding |
| --- | --- |
| Proxy lifetime | Per `WorkCalendarServiceProxy` instance |
| Disposal | `Close()` only — `WorkCalendarServiceProxy.cs:49-65` |
| Faulted-channel handling | No `Abort()` path; `Close()` on a faulted channel throws `CommunicationObjectFaultedException` and masks the original failure* |
| Thread safety | Not determined from source |

## Integration points

| System | Type | Purpose |
| --- | --- | --- |
| `SAIFDates`† | SOAP service (ASMX) | Work-day calendar lookups |

## 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)
- [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. Statements marked with `**` could
> not be confirmed; treat as unknown until verified.

## Sources
- `Services/SAIF.Services.Web.Proxies/WorkCalendarServiceProxy.cs`
- `Services/SAIF.Services.Web.Proxies/app.config`
- `Services/SAIF.Services.Web.Proxies/Service References/WorkCalendar/Reference.cs`
- `Services/SAIF.Services.WebApi/EnvironmentApi/App_Data/environments.xml`
