Data extraction using web services
You can write your own web services that use Gosu templates to generate results. The following diagram illustrates the data extraction process for a web service API that uses Gosu templates.
Every data extraction request includes a parameter indicating which Gosu template to use to format the response. You can add an unlimited number of templates to provide different responses for different types of root objects. For example, given a policy as a root object for a template, you could design different templates to export policy data, such as the following examples.
- A list of all notes on the policy
- A list of all open activities on the policy
- A summarized view of a policy
To provide programmatic access to PolicyCenter data, PolicyCenter uses Gosu, the basis
of Guidewire Studio business rules. Gosu templates allow you to embed
Gosu code that generates dynamic text from evaluating the code. Wrap
your code with <% and
%> characters for Gosu
blocks and <%= and
%> for Gosu expressions.
Once you know the root object, refer to properties on the root object or related objects just as you do as you write rules in Studio.
Before writing a template, decide which data you want to pass to the template.
For example, from a policy, refer to the properties using Gosu expressions as follows.
- policy.Account
- Account associated with this policy
- policy.Periods
- List of policy periods associated with this policy
- policy.PolicyType
- Policy type
The simplest Gosu expressions only extract
data object properties, such as policy.PolicyNumber.
For instance, suppose you want to export the policy number, use the following
short template.
The number is <%= policy.PolicyNumber %>.
At run time, Gosu runs the
code in the template block “<%=
... %>” and evaluates it dynamically.
The number is HO-1234556789.