SAIF.Services.Web.Proxies architecture¶
SAIF.Services.Web.Proxies is the outbound-integration (anti-corruption) layer for SAIF.Services and its sibling hosts: it hosts 12 generated SOAP/WCF service-reference proxies (11 authored here plus CleanAddressSvc in SAIF.Services) behind a small number of intention-revealing wrapper classes, each of which hides an internal generated client, maps SAIF.Core contract types to and from wire types, and constructs its own binding and endpoint in code rather than relying on app.config.
Responsibilities¶
- Wrap 8 authored SOAP proxies (ActiveDirectory, Document, Fax, Logging, PDFService, WorkCalendar, DbConnection, SimpleCertifiedMail) so that consumers depend on a small typed API instead of the generated
ClientBase<T>/DuplexClientBase<T>surface. - Map SAIF.Core contract DTOs (
Contact,Address,PhoneNumber,PersonName,ApplicationExceptionDetail,CertifiedLabelData,DistanceResults,FaxInfoClass,FaxRecipient,DocumentGenerationConfig,DeferredPrintConfig,PrintConfig) to and from each proxy's wire types. - Resolve outbound service endpoints, either from a caller-supplied
serviceUrl(7 wrappers) or fromIEnvironmentService.GetConfigSetting(SimpleCertifiedMailServiceProxy,GoogleMapsApiServiceProxy). - Provide one non-SOAP, hand-rolled REST/XML client,
GoogleMapsApiServiceProxy, for the Google Distance Matrix API overSystem.Net.WebRequest. - Implement
IDisposableon every wrapper to close the underlying generated client.
Component boundaries¶
ActiveDirectoryServiceProxy,DocumentServiceProxy,FaxServiceProxy,LoggingServiceProxy,PdfServiceProxy,WorkCalendarServiceProxy,Legacy.DbConnectionServiceProxy: seven uniform SOAP wrappers, each takingserviceUrlin its constructor and delegating one-to-one to wire operations.SimpleCertifiedMailServiceProxy/ISimpleCertifiedMailServiceProxy: a constructor-injected (IEnvironmentService,ILogService) wrapper around the third-party SimpleCertifiedMail ADS SOAP service, with its own configuration resolution and error logging.GoogleMapsApiServiceProxy/IGoogleMapsApiServiceProxy: a constructor-injected REST/XML client for the Google Distance Matrix API; the only wrapper that is not SOAP.Helpers/Extensions(internal): shared mapping utilities, includingMapEnumByName(used byDocumentServiceProxy) andToErrorInfoStruct(used byLoggingServiceProxy).- 11 generated
Service References/<Name>/Reference.csclients (ActiveDirectory, CallRex, CallRexState, DbConnection, Document, Fax, Logging, PDFService, SimpleCertifiedMail, SMTP, WorkCalendar): the wire-levelClientBase<T>/DuplexClientBase<T>proxies, each documented separately (see Related documentation). CallRexandCallRexStategenerated clients arepublicin the packaged assembly but have no authored wrapper and no in-repo caller; the generated SMTP client (clsSAIFMessageSoapClient) isinternaland also has no authored wrapper.
Interaction model¶
- All eight authored SOAP wrappers follow the same construction pattern: guard
serviceUrl(and other required arguments) withEnforce, build an in-codeBindingplusEndpointAddress(serviceUrl)that bypasses the<system.serviceModel><client>endpoints declared inapp.config, delegate one-to-one to the wire operation, and implementDispose()by callingwebService.Close()without anAbort()fallback on the fault path. - Endpoint resolution is split between callers and this library:
DocumentServiceProxyandLegacy.DbConnectionServiceProxyreceive their URL from the caller's own configuration key (documentGeneratorServiceUrl,dbconnectionserviceurl), whileSimpleCertifiedMailServiceProxyandGoogleMapsApiServiceProxyresolve their own URL/API key viaIEnvironmentService.GetConfigSetting. - Binding security varies per wrapper: Windows-integrated
TransportCredentialOnlyforFaxServiceProxy; HTTPSTransportsecurity forSimpleCertifiedMailServiceProxy; plain, unsecuredBasicHttpBindingforActiveDirectoryServiceProxy,LoggingServiceProxy,WorkCalendarServiceProxy,Legacy.DbConnectionServiceProxy,DocumentServiceProxy, andPdfServiceProxy. ISimpleCertifiedMailServiceProxyandIGoogleMapsApiServiceProxyare constructor-injected into SAIF.Services consumers (SubpoenaLabelService,DocumentDeferredService,SubpoenaService); no Autofac registration for either interface exists anywhere in this repository, so the composition root is external**.- This library registers no services of its own and performs no persistence; database interaction is limited to
Legacy.DbConnectionServiceProxyresolving Oracle/SQL Server connection strings remotely, through the DbConnection SOAP proxy, without executing any SQL itself.
Architecture diagram¶
The following diagram shows how SAIF.Services and other hosts consume the authored wrappers, which in turn drive the generated SOAP/WCF and REST clients hosted in this library.
flowchart TD
Consumer["SAIF.Services / SAIF.Services.Common /<br>SAIF.Services.WCF (callers)"] --> Wrappers["Authored *ServiceProxy wrappers<br>(this library)"]
Wrappers --> Generated["Generated SOAP/WCF clients<br>(Service References/*)"]
Wrappers --> GoogleRest["GoogleMapsApiServiceProxy<br>(REST/XML over WebRequest)"]
Generated --> External["11 consumed SOAP services<br>(ActiveDirectory, Document, Fax,<br>Logging, PDFService, WorkCalendar,<br>DbConnection, SimpleCertifiedMail,<br>CallRex, CallRexState, SMTP)"]
GoogleRest --> GoogleApi["Google Distance Matrix API"]
Sequence diagram¶
The following diagram shows the typical wrapper call sequence, using the certified-label request as a representative example.
sequenceDiagram
participant Client as SAIF.Services consumer
participant Proxy as SimpleCertifiedMailServiceProxy
participant Env as IEnvironmentService
participant Wire as ADSAPISoapClient (generated)
Client->>Proxy: GetLabelOnly(certifiedLabelData)
Proxy->>Env: GetConfigSetting(credential keys, as fallback)
Proxy->>Wire: getCertifiedLabel(request)
Wire-->>Proxy: label response (StatusCode, LabelImage)
Proxy-->>Client: label image, or thrown SimpleCertifiedException
Design constraints¶
- Every authored wrapper builds its own
BindingandEndpointAddressin code, which means the 15<client>endpoints and 16 binding configurations declared inapp.configare inert design-time residue; a class library'sapp.configis also not loaded by consuming hosts*. Dispose()callsClose()withoutAbort()on a faulted channel, a known WCF anti-pattern that can throw fromDisposeon a faulted proxy*.- No wrapper configures explicit SOAP send/receive timeouts (WCF defaults apply), except
GoogleMapsApiServiceProxy, which sets a 5000 msWebRequest.Timeout; onlyPdfServiceProxy.GetImageimplements retry behavior, and it delegates the actual wait/retry to the remote PDF service viaPDFCacheArgs. Legacy.DbConnectionServiceProxyrequests and returns Oracle/SQL Server connection strings, which contain credentials, over a default unsecuredBasicHttpBinding; whether the transport is HTTPS depends only on the URL scheme the caller supplies.- Three configuration values read by this library are secrets or credentials (
SimpleCertifiedMailService.Password,SimpleCertifiedMailService.PartnerKey,googlemaps.apikey) but are read with the non-secureIEnvironmentService.GetConfigSettingrather thanGetSecureConfigSetting(see Configuration). - Several referenced NuGet packages (
SAIF.Web.API.Clients,SAIF.HashUtil,Autofac,FluentValidation,log4net,Newtonsoft.Json,RestSharp) and the third-partyCallRex.Utilities.dll/CallrexAPIUtilities.dllbinaries have no authored usage in this library; it is unknown whether they are required transitively or are stale**.
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.
Related documentation¶
- Index
- Overview
- Dependencies
- Configuration
- Operations and processes
- Business rules
- API reference
- ActiveDirectory client
- CallRex client
- CallRexState client
- DbConnection client
- Document client
- Fax client
- Logging client
- PDFService client
- SimpleCertifiedMail client
- SMTP client
- WorkCalendar client
Sources¶
Services/SAIF.Services.Web.Proxies/SAIF.Services.Web.Proxies.csprojServices/SAIF.Services.Web.Proxies/ActiveDirectoryServiceProxy.csServices/SAIF.Services.Web.Proxies/DocumentServiceProxy.csServices/SAIF.Services.Web.Proxies/FaxServiceProxy.csServices/SAIF.Services.Web.Proxies/GoogleMapsApiServiceProxy.csServices/SAIF.Services.Web.Proxies/Helpers.csServices/SAIF.Services.Web.Proxies/ISimpleCertifiedMailServiceProxy.csServices/SAIF.Services.Web.Proxies/LoggingServiceProxy.csServices/SAIF.Services.Web.Proxies/PDFServiceProxy.csServices/SAIF.Services.Web.Proxies/SimpleCertifiedMailServiceProxy.csServices/SAIF.Services.Web.Proxies/WorkCalendarServiceProxy.csServices/SAIF.Services.Web.Proxies/Legacy/DbConnectionsServiceProxy.csServices/SAIF.Services.Web.Proxies/app.config