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

# Architecture

## Generation mechanism

**Service Reference (svcutil), sourced via WS-MetadataExchange.**

| Evidence | Value |
| --- | --- |
| Metadata source | `Reference.svcmap:21`: `<MetadataSource Address="http://callrexprod:8003/mex" Protocol="mex" SourceId="1" />`; all eight metadata files carry `SourceUrl="http://callrexprod:8003/mex"` (`Reference.svcmap:24-31`) |
| Supporting artifacts | `configuration.svcinfo`, `configuration91.svcinfo`, `<WCFMetadataStorage Include="Service References\CallRexState\" />` (`SAIF.Services.Web.Proxies.csproj:414`) |
| Base types | `System.ServiceModel.DuplexClientBase<IAgentStateService>` (`Reference.cs:385`); `System.ServiceModel.ClientBase<IClientAccessPolicy>` (`Reference.cs:438`). `DuplexClientBase<T>` derives from `ClientBase<T>` |
| Async scaffolding | None generated — `Reference.svcmap:4` sets `GenerateAsynchronousMethods` to `false` |
| Remote technology | `wcf`: metadata from a `mex` endpoint; WCF DataContract namespaces in the schemas; `netdx:Duplex DuplexMode="MultipleMessagesPerPoll"`, `msb:BinaryEncoding`, `cdp:CompositeDuplex` with WS-ReliableMessaging policy assertions (`service.wsdl:3-24`) |

This is **not** a wsdl.exe Web Reference: there is no `SoapHttpClientProtocol` base type anywhere in the generated code, and the artifact set (`Reference.svcmap`, `.svcinfo` files, `DuplexClientBase<T>`) is the svcutil/Service Reference shape.

The `Silverlight` contract namespace and the polling-duplex binding suggest the service was originally built for Silverlight clients*. The vendor is inferred to be the CallRex call-recording platform*, based on the proxy name, the shared `callrexprod` host, and the sibling `CallRex` proxy (see [CallRex](../callrex/index.md)).

## Construction

**No construction exists in this repository.** No source file builds an `InstanceContext`, implements `IAgentStateServiceCallback`, or constructs `AgentStateServiceClient` or `ClientAccessPolicyClient`.

## Endpoint resolution

**Resolution method: `configured-endpoint`**, read from the consuming project's `app.config`. No hand-written code overrides it, because no code constructs the client.

| Endpoint name | Address | Binding | Contract | Evidence |
| --- | --- | --- | --- | --- |
| `PollingDuplexHttpBinding_IAgentStateService` | `http://callrexprod:8003/AgentStateService` | `customBinding` / `PollingDuplexHttpBinding_IAgentStateService` | `CallRexState.IAgentStateService` | `app.config:71` |
| `WSDualHttpBinding_IAgentStateService` | `http://callrexprod:8003/AgentStateService2` | `wsDualHttpBinding` / `WSDualHttpBinding_IAgentStateService` | `CallRexState.IAgentStateService` | `app.config:72` |
| (none) | — | — | `CallRexState.IClientAccessPolicy` | **No endpoint configured**, and none in the WSDL |

**Contract-name check:** config `contract="CallRexState.IAgentStateService"` matches generated `ConfigurationName="CallRexState.IAgentStateService"` (`Reference.cs:356`) — no mismatch.

**Ambiguity:** two endpoints exist for one contract, so `AgentStateServiceClient(InstanceContext)` with no endpoint name would be ambiguous; a caller would have to pass an endpoint configuration name*. No such caller exists.

**Generation-time origin (not runtime):** `http://localhost:8003/AgentStateService` and `http://localhost:8003/AgentStateService2` (`service.wsdl:130,136`). The configured host `callrexprod` was substituted after generation, matching the pattern seen on the sibling `CallRex` proxy.

**Runtime applicability:** a class library's `app.config` is not read at run time by a consuming host*. A host would need to copy this `<client>` block into its own configuration file. No host in this repository does so.

## Binding configuration

| Binding | Settings | Evidence |
| --- | --- | --- |
| `customBinding` / `PollingDuplexHttpBinding_IAgentStateService` | `<binaryMessageEncoding />` + `<httpTransport />` only | `app.config:38-41` |
| `wsDualHttpBinding` / `WSDualHttpBinding_IAgentStateService` | `closeTimeout="00:01:00"`, `openTimeout="00:01:00"`, `receiveTimeout="00:10:00"`, `sendTimeout="00:01:00"`, `maxReceivedMessageSize="20000000"`, `useDefaultWebProxy="false"`, `readerQuotas maxStringContentLength="8192" maxArrayLength="16384"`, `reliableSession ordered="true" inactivityTimeout="00:10:00"`, `<security mode="None" />` | `app.config:44-48` |

**Finding — polling-duplex binding is incomplete.** The WSDL policy requires `netdx:Duplex MultipleMessagesPerPoll` (`service.wsdl:6`), but the generated `customBinding` (`app.config:38-41`) contains no polling-duplex binding element, so a desktop .NET client built from this configuration would lack the duplex-polling behavior the service requires*. Polling duplex is a Silverlight client-side binding element that full .NET Framework does not ship*. This gap is recorded, not remediated, on [Tech debt](tech-debt.md).

**Credential mode:** `wsDualHttpBinding` uses `security mode="None"` (`app.config:47`). The custom binding declares no security element and no authentication scheme, so it is anonymous HTTP*.

## Invocation path

Not applicable — there is no call site anywhere in this repository, and no type implements `IAgentStateServiceCallback`.

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

## Sources
- `Services/SAIF.Services.Web.Proxies/Service References/CallRexState/Reference.cs`
- `Services/SAIF.Services.Web.Proxies/Service References/CallRexState/Reference.svcmap`
- `Services/SAIF.Services.Web.Proxies/Service References/CallRexState/service.wsdl`
- `Services/SAIF.Services.Web.Proxies/app.config`
- `Services/SAIF.Services.Web.Proxies/SAIF.Services.Web.Proxies.csproj`
