How to specify Decision Service effective timestamp in a SOAP request message
- Last Updated: August 14, 2023
- 2 minute read
- Corticon
- Documentation
How to specify Decision Service effective timestamp in a SOAP request message
As with decisionServiceTargetVersion, the
CorticonRequest complexType also includes an optional
decisionServiceEffectiveTimestamp attribute. This
attribute (again, we're talking about attribute in the XML sense, not the Corticon Vocabulary sense) is included in all
service contracts generated from Corticon Studio. Refer to the topic How to integrate Corticon Decision Services for full details of the XML service
contracts supported (XSD and WSDL).
The relevant section of the XSD is shown below:
<xsd:attribute name=“decisionServiceEffectiveTimestamp” use=“optional”
type=“xsd:dateTime” />
Updating CorticonRequest with decisionServiceEffectiveTimestamp according to the XSD, our new
XML payload looks like this:
<CorticonRequest xmlns="urn:decision:tutorial_example"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
decisionServiceName="skydiver4_dates"
decisionServiceEffectiveTimestamp="8/15/2012">
<WorkDocuments>
<Person id="Person_id_2">
<age>42</age>
<skydiver>true</skydiver>
<ssn>111-22-1111</ssn>
</Person>
</WorkDocuments>
</CorticonRequest>
Execute the request - Use your preferred SOAP API to execute the request.The response from Corticon Server is:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:CorticonResponse xmlns:ns1="urn:decision:tutorial_example" xmlns="urn:decision:tutorial_example" decisionServiceEffectiveTimestamp="8/15/2012" decisionServiceName="skydiver4_dates">
<ns1:WorkDocuments>
<ns1:Person id="Person_id_2">
<ns1:age>42</ns1:age>
<ns1:riskRating>medium</ns1:riskRating>
<ns1:skydiver>false</ns1:skydiver>
<ns1:ssn>111-22-1111</ns1:ssn>
</ns1:Person>
</ns1:WorkDocuments>
<ns1:Messages version="1.0">
<ns1:Message>
<ns1:severity>Info</ns1:severity>
<ns1:text>A person over 35 years old that does not skydive is rated as medium risk.</ns1:text>
<ns1:entityReference href="#Person_id_2" />
</ns1:Message>
</ns1:Messages>
</ns1:CorticonResponse>
</soapenv:Body>
</soapenv:Envelope>
Corticon Server executed this
request message using Decision Service version 1.0, which
has the Effective/Expiration Date pair of 1/1/2012—12/31/2013. That is the only version of
the Decision Service “effective” for the date specified in the request
message's Effective Timestamp. The version that was executed shows in the version attribute of the <Messages> complexType.
To illustrate what happens when an Effective Timestamp falls in range of
more than one Major Version of deployed Decision Services, let's modify our request message
with a decisionServiceEffectiveTimestamp of 8/15/2013, as shown:
<CorticonRequest xmlns="urn:decision:tutorial_example"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
decisionServiceName="skydiver4_dates"
decisionServiceEffectiveTimestamp="8/15/2013">
<WorkDocuments>
<Person id="Person_id_2">
<age>42</age>
<skydiver>true</skydiver>
<ssn>111-22-1111</ssn>
</Person>
</WorkDocuments>
</CorticonRequest>
Send this request to Corticon Server, and then examine the response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:CorticonResponse xmlns:ns1="urn:decision:tutorial_example" xmlns="urn:decision:tutorial_example" decisionServiceEffectiveTimestamp="8/15/2013" decisionServiceName="skydiver4_dates">
<ns1:WorkDocuments>
<ns1:Person id="Person_id_2">
<ns1:age>42</ns1:age>
<ns1:riskRating>low</ns1:riskRating>
<ns1:skydiver>false</ns1:skydiver>
<ns1:ssn>111-22-1111</ns1:ssn>
</ns1:Person>
</ns1:WorkDocuments>
<ns1:Messages version="3.0">
<ns1:Message>
<ns1:severity>Info</ns1:severity>
<ns1:text>A person 55 years old or younger is rated as low risk.</ns1:text>
<ns1:entityReference href="#Person_id_2" />
</ns1:Message>
</ns1:Messages>
</ns1:CorticonResponse>
</soapenv:Body>
</soapenv:Envelope>
This time Corticon Server executed
the request with version 3. It did so because whenever a
request's decisionServiceEffectiveTimestamp value falls
within range of more than one deployed Decision Service, Corticon Server chooses the Decision Service with the highest Major Version number. In this case, all three Decision Services were
effective on 8/15/2013, so Corticon Server chose
version 3 – the highest qualifying Version – to execute
the request.