SimpleCertifiedMailServiceProxy¶
SimpleCertifiedMailServiceProxy implements ISimpleCertifiedMailServiceProxy over the public generated ADSAPISoapClient, the only wrapper in this library that resolves both its endpoint and its fallback credentials from IEnvironmentService rather than taking a caller-supplied URL, and the only one that logs a domain-specific failure exception before raising it. It is constructor-injected into SubpoenaLabelService and DocumentDeferredService.
Purpose¶
- Size a default certified-mail label by page count and reject requests over 76 pages (WP-BR-015).
- Resolve the SimpleCertifiedMail endpoint URL and any caller-omitted credentials (
UserName,Password,ClientCode,PartnerKey) fromIEnvironmentService.GetConfigSetting(WP-BR-014). - Select
productionorpreviewmode from an explicit caller flag orIEnvironmentService.IsProduction(WP-BR-019). - Log and raise
SimpleCertifiedExceptionwhen the remote service returns a non-success status code (WP-BR-018).
Context¶
- Namespace:
SAIF.Services.Web.Proxies - Assembly/package:
SAIF.Services.Web.Proxies(packaged inSAIF.SAIFCode.Core)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| Constructor | SimpleCertifiedMailServiceProxy(IEnvironmentService environmentService, ILogService logService) |
Guards both injected services, builds an HTTPS BasicHttpBinding(Transport) client, and reads the endpoint from GetConfigSetting("SimpleCertifiedMailService.Url") (WP-BR-001, WP-BR-014) |
GetDefaultLabelData |
CertifiedLabelData GetDefaultLabelData(int numberOfPages) |
Returns default label data with envelope size determined by page count, throwing InvalidNumberOfPagesException for more than 76 pages (WP-BR-015) |
GetLabelOnly |
CertifiedLabelData GetLabelOnly(CertifiedLabelData data) |
Requests a label from the remote service and discards the returned image (WP-BR-016) |
SaveLabelAsGif |
void SaveLabelAsGif(CertifiedLabelData data, string fileName) |
Requests a label, Base64-decodes it, and saves it as fileName + ".gif"; does nothing if the label is null |
GetModeOption |
ModeOptions GetModeOption(bool? isProductionMode) |
Resolves production/preview from the explicit flag, or from IEnvironmentService.IsProduction when the flag is null (WP-BR-019) |
Dispose |
void Dispose() |
Closes the underlying generated ADSAPISoapClient by calling Close(), without an Abort() fallback on a faulted channel* |
Behavioral notes¶
- The private
GetCertifiedLabeltruncatesFromAddress1,FromAddress2, andToNameto 46 characters before sending the request (WP-BR-017). - A non-
1StatusCodein the wire response is logged viaILogService.LogException("SimpleCertifiedMailService", "GetCertifiedLabel", "", ex)and then raised asSimpleCertifiedException(WP-BR-018). - Callers can bypass configuration entirely by supplying credentials directly on
CertifiedLabelData;DocumentDeferredService.cslines 112–114 do this, and when present these values take precedence over configuration.
Constraints and usage notes¶
- Message-level
ClientCredentialType = Certificateis set on the binding but has no effect inTransportsecurity mode*. - No Autofac registration for this class (via
ISimpleCertifiedMailServiceProxy) exists anywhere in this repository; the composition root is external**.
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/SimpleCertifiedMailServiceProxy.csServices/SAIF.Services.Web.Proxies/ISimpleCertifiedMailServiceProxy.cs