User-defined transactions (UDTs) allow you to combine several requests into a single aggregate request. The API Transaction Set processes this aggregate request as a unit, providing transactional integrity at the overall request level.
TIBCO ActiveMatrix Adapter for Kenan/BP uses the Document Object Model (DOM) interface to execute standard API-TS and UDT requests.
UDT Service CustomerUdtRequest and AdminUdtRequest are shipped with the Kenan FX UDT module. You can also customize a UDT Service to perform different transactions, for example, to image a transaction process of a particular GUI screen.
<AccountServer e-dtype="int">3 </AccountServer>
<ApplicationName e-dtype="string">null</ApplicationName>
<OperatorName e-dtype="string">null</OperatorName>
<Fetch e-dtype="boolean">true</Fetch>
<AccountInternalId e-dtype="int">87</AccountInternalId>
<RequestId e-dtype="string">RootAccount</RequestId>
<Ref e-dtype="string">RootAccount/Account/Key/AccountInternalId</Ref>
<RequestId e-dtype="string">AccountBalanceSummary1</RequestId>
<Fetch e-dtype="boolean">true</Fetch>
<BillingAccountInternalId>
<Ref e-dtype="string">RootAccount/Account/Key/AccountInternalId</Ref>
</BillingAccountInternalId>
<RequestId e-dtype="string">NrcFind1</RequestId>
2.
|
The AccoutBalanaceSummary is calculated for the same Account. Here what has to be noted is that the AccountInternalId is given as: <Ref e-dtype="string">RootAccount/Account/Key/AccountInternalId</Ref> And not as an absolute number. Moreover, the initial XML block (ref pt. 1) has <RequestId e-dtype="string">RootAccount</RequestId>.
This means all subsequent references to this account can be made with the RootAccount symbol.
|
This is an example of UDTs at work. This method of one request accessing variables from another request is also known as the X-Path method. There are several ways to refer to data from other requests of the same UDT call:
The generic UDT Service provided by Kenan is called
CustomerUdtRequest with a corresponding XSD Schema called
CustomerUdtRequest.xsd; the
CustomerUdtRequest.xsd file has references to over 60.xsd schema files, so the schema reference for UDT covers all available operations using UDT, and is a fairly large set of.xsd files.
The tool pops up a dialog prompting the user to select objects they need to use in the project. Only the user selection is imported into the project.
|
A Ref XML element is added to request.xsd. This allows the user to construct UDT requests with XPath referencing.
|
b.
|
In the Import Resource or File dialog box, select Folder from the Format drop down menu and browse to select the folder that contains the custom XSD files (the same folder that you specified as output directory when generating the custom XSD files). Click OK.
|
The XPath language provides a means of navigating to a particular element in an XML document. The portion of the XPath language used in UDTs lets you identify an XML element within a DOM using a path, much like a directory path in a file system.
Within a UDT, each request has a <RequestId> element that gives a unique
name to that request. You can use this name (within an XPath path) to access elements from a previous request within that call.
|
The Ref element is defined in the UDT tool-generated ' request.xsd'. If the new xsd file set has been generated outside of the UDT tool and imported into Business Works, the original request.xsd will not include this Ref element, and Ref will not display.
|
6.
|
Click Apply to save changes.
|
Here is an example of a customized CustomerUDTRequest.xsd file, it has fewer referred schema files and a simple structure:
xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
elementFormDefault = "qualified"
attributeFormDefault = "unqualified">
<xsd:include schemaLocation = "Account.xsd"/>
<xsd:include schemaLocation = "AccountBalances.xsd"/>
<xsd:include schemaLocation = "AccountHqContract.xsd"/>
<xsd:include schemaLocation = "AccountId.xsd"/>
<xsd:include schemaLocation = "BalanceLineItem.xsd"/>
<xsd:include schemaLocation = "Nrc.xsd"/>
<xsd:element name = "CustomerUdtRequest">
<xsd:element name = "RequestList">
<xsd:element name = "Account" type = "AccountRequest"/>
<xsd:element name = "Nrc" type = "NrcRequest"/>
<xsd:attribute name = "e-dtype" fixed = "list" type = "xsd:string"/>
<xsd:complexType name = "RequestHeader">
<xsd:element name = "RequestId">
<xsd:extension base = "xsd:ID">
<xsd:attribute name = "e-dtype" fixed = "string" type = "xsd:string"/>
<xsd:element name = "InputRequest" minOccurs = "0">
<xsd:sequence minOccurs = "0">
<xsd:element name = "RequestId">
<xsd:extension base = "xsd:IDREF">
<xsd:attribute name = "e-dtype" fixed = "string" type = "xsd:string"/>
<xsd:element name = "RelationshipId" minOccurs = "0">
<xsd:extension base = "xsd:IDREF">
<xsd:attribute name = "e-dtype" fixed = "string" type = "xsd:string"/>
<xsd:complexType name = "AccountRequest">
<xsd:extension base = "RequestHeader">
<xsd:sequence minOccurs = "0">
<xsd:element ref = "AccountGet"/>
<xsd:element ref = "AccountBalanceSummary"/>
<xsd:element name = "SubRequest" minOccurs = "0">
<xsd:sequence maxOccurs = "unbounded">
<xsd:element name = "RelationshipId" type = "String" fixed = "Nrc_AccountBalances_Ref"/>
<xsd:element name = "NrcRequest" minOccurs = "0">
<xsd:extension base = "NrcRequest">
<xsd:element name = "RelationshipId" type = "String" fixed = "Nrc_Parent"/>
<VipCode e-dtype="int">0</VipCode>
<ViewStatus e-dtype="int">1</ViewStatus>
When the direct parsing function is enabled in TIBCO Designer, the adapter makes some modification to the structure of the original response data to simplify the data parsing process. The following is an example of response data with the direct parsing enabled. The UDT request is exactly the same with the one associated with the above mentioned example.
<VipCode e-dtype="int">0</VipCode>
<ViewStatus e-dtype="int">1</ViewStatus>
The response result information for each request method is contained in a pair of XML elements:
ProductGetResponse or
AccountGetResponse, which are marked in bold. You can use the response schema (
CustomerUdtResponse.xsd) generated by the UDT Tools to parse this response easily using TIBCO ActiveMatrix BusinessWorks. Please refer to
TIBCO Adapter for Kenan/BP Example Guide for more information
.