Document generation, preview, distribution and print¶
DocumentServiceProxy wraps the Document SOAP service (clsGenerateSoapClient) to preview a PDF, list categories/packages, and distribute or print a document package, mapping SAIF.Core document, mail, and fax contract types to the wire types on every call.
| Field | Value |
|---|---|
| Operation ID | OP-WP-02 |
| Trigger | SAIF.Services.Utilities.Documents.DocumentService (constructed at DocumentService.cs:35), or package consumers |
| Inputs | Package/profile/category names; DocumentGenerationConfig; MailMessage; FaxInfoClass; DeferredPrintConfig; PrintConfig |
| Outputs | PDF bytes, sorted category/package arrays, or a distribution/print side effect |
| Primary components | DocumentServiceProxy.PreviewPdf, GetCategories, GetPackages, DistributeDocument, DistributeDocumentDocCenter, PrintDocument |
| Entry point | Services/SAIF.Services.Web.Proxies/DocumentServiceProxy.cs |
Steps¶
- Construct
DocumentServiceProxy(serviceUrl): guardserviceUrl(WP-BR-001), then build aBasicHttpBindingwithMaxReceivedMessageSizeandMaxArrayLengthset toint.MaxValue. PreviewPdf(package, xml, profile): guardpackageandxmlare not null/whitespace (WP-BR-001), then call wirepreviewDocument(package, xml, profile, inApplication: "xPression Design")(WP-BR-004) and return the PDF bytes.GetCategories(): call wirecategoriesForUser(ref "xPression Design")and return the categories sorted ascending (WP-BR-005).GetPackages(category): call wiredocumentsForCategory(ref category, ref "xPression Design")and return the result sorted ascending (WP-BR-005).DistributeDocument(docConfig, printer, copies, plexMode, scaleMode, paperTray, imageImportSettings, mailMessage, faxInfo, deferredPrintConfig, imagePath):- Guard
docConfig. - Map
PlexMode,ScaleMode, andPaperTrayby name viaHelpers.MapEnumByName(WP-BR-006).- On failure: an unmatched enum name throws
ArgumentNullException.
- On failure: an unmatched enum name throws
- Map
MailMessagetoEmailInfoClass, settingBCC/CConly when non-empty; a null message produces a null result (WP-BR-007). - Map
DeferredPrintConfigtoDeferredPrintInfoClass, copyingSortField0–SortField9intoSort0Value–Sort9Value; a null config produces null. - Call wire
distributeDocument(inPackage, inXML, inPrinter, inMode, inCopies, inScaleMode, inOutputProfile, inImportInfo, inEmailInfo, inFaxInfo, inIDMPath, inTray, inDeferredInfo, inApplication)withdocConfig.OutputProfile, fax info forced to null (WP-BR-008), and application"xPression Design".- Note: the
faxInfostring parameter is ignored; it is suppressed via CA1801.
- Note: the
DistributeDocumentDocCenter(docConfig, printer, copies, plexMode, scaleMode, paperTray, imageImportSettings, mailMessage, faxInfo, deferredPrintConfig, imagePath): the same mapping as step 5, with these differences:- Uses
docConfig.OutputProfileOverride. - Maps
FaxInfoClassto the wireFaxInfoClassonly whenToFaxNumberis non-empty; otherwise fax is null (WP-BR-009). - Uses
docConfig.ApplicationNamewhen set, falling back to"xPression Design"(WP-BR-004). - On failure: a null
faxInfoargument throwsNullReferenceException, becauseMapFaxMessagedereferences it without a guard. PrintDocument(docConfig, printConfig): guard both arguments, then call wiredistributeDocumentwith the printer, plex, copies, scale, and tray taken fromprintConfig,docConfig.OutputProfile, empty import info and IDM path, null email/fax/deferred info, and application"xPression Design".
Process flow¶
The following diagram visualizes the branch between preview/catalog reads and the distribution/print write path.
flowchart TD
Start([Caller invokes wrapper method]) --> Which{Which method?}
Which -->|PreviewPdf| Guard1[Guard package/xml] --> Preview[Call previewDocument] --> RetPdf([Return PDF bytes])
Which -->|GetCategories/GetPackages| Cat[Call wire operation] --> Sort["Sort result ascending"] --> RetSorted([Return sorted array])
Which -->|Distribute or Print| MapEnums["Map Plex/Scale/Tray by name"] --> MapMail["Map MailMessage,<br>DeferredPrintConfig, FaxInfoClass"] --> Dist[Call distributeDocument] --> RetDist([Distribution side effect])
Failure and edge-case behavior¶
- A null/whitespace
package,xml, orserviceUrlthrows an argument exception before the wire call. - An unmatched enum name in
Helpers.MapEnumByNamethrowsArgumentNullException. DistributeDocumentDocCenterthrowsNullReferenceExceptionon a nullfaxInfoargument.DistributeDocument'sfaxInfostring parameter is always ignored, which is a documented parameter-mismatch finding rather than a defect in this operation's contract.
Related documentation¶
Sources¶
Services/SAIF.Services.Web.Proxies/DocumentServiceProxy.csServices/SAIF.Services.Web.Proxies/Helpers.cs