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

# Architecture

`ActiveDirectoryServiceProxy` constructs the generated `clsADServicesSoapClient` directly from a `BasicHttpBinding` and a caller-supplied `EndpointAddress`, bypassing the two `<client><endpoint>` entries configured in `app.config`.

## Proxy mechanism

| Aspect | Finding |
| --- | --- |
| Mechanism | Service Reference (svcutil) |
| Proxy type | `SAIF.Services.Web.Proxies.ActiveDirectory.clsADServicesSoapClient` |
| Base type | `System.ServiceModel.ClientBase<SAIF.Services.Web.Proxies.ActiveDirectory.clsADServicesSoap>` |
| Contract type | `SAIF.Services.Web.Proxies.ActiveDirectory.clsADServicesSoap` (`internal`) |
| Constructed in | `ActiveDirectoryServiceProxy` constructor (`Services/SAIF.Services.Web.Proxies/ActiveDirectoryServiceProxy.cs:18-21`) |
| Binding configured in | Code — `new BasicHttpBinding()` with framework defaults |
| Address supplied by | Constructor argument `serviceUrl`, whose own origin is unresolved within this repository |

## Construction path

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

```mermaid
flowchart TD
    CALLER["External consumer of<br>SAIF.SAIFCode.Core"] --> WRAP["ActiveDirectoryServiceProxy<br>hand-written wrapper"]
    WRAP --> BIND["BasicHttpBinding()<br>constructed in code, defaults"]
    BIND --> ADDR["EndpointAddress(serviceUrl)<br>caller-supplied, origin unresolved"]
    ADDR --> PROXY["clsADServicesSoapClient<br>generated proxy (internal)"]
    PROXY --> REMOTE["Remote service<br>clsADServices (ASMX)"]
    WRAP --> DISPOSE["Close() on Dispose,<br>no Abort() fallback"]
```

## Hand-written wrapper

| Field | Value |
| --- | --- |
| **Type** | `SAIF.Services.Web.Proxies.ActiveDirectoryServiceProxy` |
| **Source** | `Services/SAIF.Services.Web.Proxies/ActiveDirectoryServiceProxy.cs` |
| **Visibility** | `public` |
| **Implements** | `IDisposable` |
| **Responsibility** | Constructs the internal generated client from a caller-supplied URL, exposes four operations by name, and disposes the client |
| **Proxy lifetime** | Per wrapper instance |

| Configuration applied | Value | Source |
| --- | --- | --- |
| Binding security mode | `BasicHttpSecurityMode.None` (default; not overridden) | `ActiveDirectoryServiceProxy.cs:19` |
| Transport client credential | None set* | `ActiveDirectoryServiceProxy.cs:19` |
| `MaxReceivedMessageSize` | 65,536 bytes (framework default, not overridden)* | `ActiveDirectoryServiceProxy.cs:19` |
| `MaxBufferSize` | Framework default, not overridden* | `ActiveDirectoryServiceProxy.cs:19` |
| Timeouts | None set — binding defaults apply (1 min send/open/close, 10 min receive)* | `ActiveDirectoryServiceProxy.cs:19` |

## Endpoint resolution

| Environment | Address | Resolved from | Changeable without a rebuild |
| --- | --- | --- | --- |
| All | Caller-supplied `serviceUrl`; the design-time (unused) configured value is `http://webqa/WebServices/ADWebService/clsADServices.asmx` | `Services/SAIF.Services.Web.Proxies/ActiveDirectoryServiceProxy.cs:14-16` (parameter origin unresolved**) | Yes — the caller who constructs `ActiveDirectoryServiceProxy` controls it, but this repository does not show who that caller is or how the URL reaches them |

## Lifetime and disposal

| Aspect | Finding |
| --- | --- |
| Proxy lifetime | Per wrapper instance |
| Disposal | `Dispose()` calls `webService.Close()`, with no `try`/`catch` and no `Abort()` fallback |
| Faulted-channel handling | Not handled — if the channel is faulted, `Close()` throws `CommunicationObjectFaultedException` from `Dispose`, which can mask the original failure inside a `using` block* |
| Thread safety | Not determined from source |

## Integration points

| System | Type | Purpose |
| --- | --- | --- |
| `clsADServices` | ASMX web service reached through a WCF-style `ClientBase<T>` proxy | Printer lookup, cached authorization checks, and contact lookups delegated to Active Directory* |

## 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 `*` 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/ActiveDirectoryServiceProxy.cs`
- `Services/SAIF.Services.Web.Proxies/app.config`
- `Services/SAIF.Services.Web.Proxies/Service References/ActiveDirectory/Reference.cs`
