Skip to content

Retrieve a cached PDF image

PdfServiceProxy.GetImage wraps the PDFService WCF client (PDFServiceClient) to request a cached image by sequence number, asking the remote service to render and cache it immediately, and waiting through a bounded retry loop if it is not yet ready.

Field Value
Operation ID OP-WP-05
Trigger A caller request; no in-repository code constructs this wrapper
Inputs long imageSeqNum, int maxWaitTimeInSeconds = 10
Outputs Image bytes
Primary components PdfServiceProxy.GetImage
Entry point Services/SAIF.Services.Web.Proxies/PDFServiceProxy.cs

Steps

  1. Construct PdfServiceProxy(serviceUrl, database): guard both arguments (WP-BR-001), then build a BasicHttpBinding with int.MaxValue quotas; database is stored as the data environment.
  2. GetImage(imageSeqNum, maxWaitTimeInSeconds): build a PDFCacheArgs (WP-BR-011):
  3. ImageSeqNum = imageSeqNum
  4. DataEnvironment = database
  5. CachePriority = 10000 ("retrieve, process and cache immediately")
  6. DataUser = "IMG" (a pool code, not a schema)
  7. WaitCacheEnabled = true
  8. WaitCacheRetryAttempts = maxWaitTimeInSeconds (default 10)
  9. WaitCacheRetryInterval = 1000 ms
  10. Call wire LoadCache(args) and return result.File as bytes.
  11. On failure: a null result returned by the wire call throws NullReferenceException.

Process flow

The following diagram visualizes the cache-and-retry request.

flowchart TD
    Start([GetImage invoked]) --> Build["Build PDFCacheArgs<br>(priority 10000, retry n times)"]
    Build --> Call["Call wire LoadCache(args)"]
    Call --> Check{result null?}
    Check -->|Yes| Fail([NullReferenceException])
    Check -->|No| Ret([Return result.File as bytes])

Failure and edge-case behavior

  • A null/empty serviceUrl or database at construction throws an argument exception before any wire client is created.
  • A null result from LoadCache throws NullReferenceException; there is no null guard on the wire response.
  • The wait/retry behavior is delegated entirely to the remote PDF service via PDFCacheArgs; this wrapper implements no client-side retry loop of its own.

Sources

  • Services/SAIF.Services.Web.Proxies/PDFServiceProxy.cs