Skip to content

Authenticated/cached HTTP GET

Provide a base HTTP client with lazy construction, credential resolution, and optional response caching for Guidewire API calls.

Field Value
Operation ID OP-SD-02
Trigger A derived client class issues a GET or cached GET/POST call.
Inputs Request URL, optional request body, UseCache/ensureSuccess flags
Outputs Deserialized response of type T, or a cached copy
Primary components HttpClientBase
Entry point Data/SAIF.Data/Clients/HttpClientBase.cs

Steps

  1. Lazily create the HttpClient. The base URL comes from IEnvironmentService.GetConfigSetting(UrlKey) (SD-BR-003).
  2. If AuthKey is set, compute the system hash: SystemHashUtil.ComputeHash(SystemType, SystemName) when a SystemName is supplied, otherwise SystemHashUtil.Get(SystemType) (SD-BR-004).
  3. Delegates: SAIF.HashUtil.
  4. Read GetSecureConfigSetting(AuthKey, hash), split it on \| into user and password, and build an HttpClientHandler with a NetworkCredential (SD-BR-004).
  5. Delegates: SAIF.Framework.Core / IEnvironmentService.
  6. GetAsyncCached<T>: build the cache key {Type}-{url}-{ensureSuccess}[-bodyhash], execute through the Polly cache policy (or a NoOp policy when UseCache is false), then send a GET or a POST when a body is supplied (SD-BR-002).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([A derived client class issues a GET or cached GET/POST call.]) --> S1["`HttpClientBase`"]
    S1 --> S2{"Rules satisfied?"}
    S2 -->|Yes| EndOk([Result returned])
    S2 -->|No| EndErr([Exception / empty result])

Failure and edge-case behavior

  • AuthKey unset: the handler is built without a NetworkCredential (anonymous request).
  • UseCache false: the NoOp policy bypasses caching entirely.

Sources

  • Data/SAIF.Data/Clients/HttpClientBase.cs