---
title: DocumentServiceProxy
summary: API reference for DocumentServiceProxy.
status: draft
owner: SAIF.Core Documentation Team
last_reviewed: 2026-09-24
library: SAIF.Services.Web.Proxies
reference_type: package
---

# DocumentServiceProxy

`DocumentServiceProxy` hides the internal generated `clsGenerateSoapClient` behind the xPression Design document workflow — preview, catalog listing, distribution (standard and DocCenter variants), and print — mapping SAIF.Core document, mail, and fax contract types to the wire types on every call. It is constructed by `SAIF.Services.Utilities.Documents.DocumentService`.

## Purpose
- Preview a rendered PDF for a document package before distribution ([OP-WP-02](../../operations/document-generation-preview-distribution-and-print.md)).
- List document categories and packages, always sorted ascending ([WP-BR-005](../../business-rules.md#wp-br-005-document-categories-and-packages-are-sorted-ascending)).
- Distribute a document by email, fax, or deferred print, mapping enums by name and applying the standard-vs-DocCenter fax rules ([WP-BR-006](../../business-rules.md#wp-br-006-plex-scale-and-paper-tray-enums-map-by-name) through [WP-BR-009](../../business-rules.md#wp-br-009-doccenter-distribution-sends-fax-info-only-when-present)).
- Print a document directly, mapping print configuration onto the same underlying wire operation used for distribution.

## Context
- Namespace: `SAIF.Services.Web.Proxies`
- Assembly/package: `SAIF.Services.Web.Proxies` (packaged in `SAIF.SAIFCode.Core`)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| Constructor | `DocumentServiceProxy(string serviceUrl)` | Guards `serviceUrl`, then builds a `BasicHttpBinding` with `MaxReceivedMessageSize`/`MaxArrayLength` set to `int.MaxValue` ([WP-BR-001](../../business-rules.md#wp-br-001-required-arguments-must-be-non-null-or-non-empty)) |
| `PreviewPdf` | `byte[] PreviewPdf(string package, string xml, string profile)` | Guards `package`/`xml`, then returns rendered PDF bytes from `previewDocument`, identifying the caller as `"xPression Design"` ([WP-BR-004](../../business-rules.md#wp-br-004-document-calls-identify-as-xpression-design)) |
| `GetCategories` | `string[] GetCategories()` | Returns the document categories available to the current user, sorted ascending ([WP-BR-005](../../business-rules.md#wp-br-005-document-categories-and-packages-are-sorted-ascending)) |
| `GetPackages` | `string[] GetPackages(string category)` | Returns the packages within a category, sorted ascending ([WP-BR-005](../../business-rules.md#wp-br-005-document-categories-and-packages-are-sorted-ascending)) |
| `DistributeDocument` | `void DistributeDocument(DocumentGenerationConfig docConfig, string printer, int copies, PlexMode plexMode, ScaleMode scaleMode, PaperTray paperTray, object imageImportSettings, MailMessage mailMessage, string faxInfo, DeferredPrintConfig deferredPrintConfig, string imagePath)` | Distributes a document by print/email/deferred-print; the `faxInfo` string parameter is always ignored, so fax is never sent through this method ([WP-BR-008](../../business-rules.md#wp-br-008-standard-distribution-never-sends-fax-info)) |
| `DistributeDocumentDocCenter` | `void DistributeDocumentDocCenter(DocumentGenerationConfig docConfig, string printer, int copies, PlexMode plexMode, ScaleMode scaleMode, PaperTray paperTray, object imageImportSettings, MailMessage mailMessage, FaxInfoClass faxInfo, DeferredPrintConfig deferredPrintConfig, string imagePath)` | Distributes a document from DocCenter, sending fax info only when `ToFaxNumber` is present and using `docConfig.ApplicationName` when set ([WP-BR-009](../../business-rules.md#wp-br-009-doccenter-distribution-sends-fax-info-only-when-present)) |
| `PrintDocument` | `void PrintDocument(DocumentGenerationConfig docConfig, PrintConfig printConfig)` | Prints a document directly, with null email/fax/deferred info and application `"xPression Design"` |
| `Dispose` | `void Dispose()` | Closes the underlying generated `clsGenerateSoapClient` by calling `Close()`, without an `Abort()` fallback on a faulted channel* |

## Behavioral notes
- Enum mapping is performed by name via `Helpers.MapEnumByName`; an unmatched name throws `ArgumentNullException` ([WP-BR-006](../../business-rules.md#wp-br-006-plex-scale-and-paper-tray-enums-map-by-name)).
- `DistributeDocumentDocCenter` throws `NullReferenceException` on a null `faxInfo` argument, because `MapFaxMessage` dereferences it without a guard.
- `DistributeDocument`'s `faxInfo` string parameter is a documented parameter-mismatch finding: it exists on the signature but is never used to send a fax.

## Constraints and usage notes
- Callers must supply the endpoint URL; this wrapper reads no configuration of its own.
- `MailMessage`/`DeferredPrintConfig` mapping tolerates a null input by producing a null output, so callers do not need to construct empty placeholder objects.

> **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/DocumentServiceProxy.cs`
- `Services/SAIF.Services.Web.Proxies/Helpers.cs`
