Thursday, March 14, 2013

Business Rules With Abstract XML Facts As Input

If you are writing business rules with some abstract xml facts as input and at runtime a concrete xml will be passed then make sure that "Check Rule Flow" is unchecked. Otherwise business rule validator will always report a validation error message.

XML supports inheritance and so the top level xml element can be of abstract type as shown below -


Above elements is defined in this manner in schema -


<xsd:complexType name="Document" abstract="true">
<xsd:annotation>
<xsd:documentation xml:lang="en">The abstract base type from which all FpML compliant messages and documents must be derived.</xsd:documentation>
</xsd:annotation>
<xsd:attributeGroup ref="StandardAttributes.atts"/>
</xsd:complexType>


<xsd:complexType name="Message" abstract="true">
<xsd:annotation>
<xsd:documentation xml:lang="en">A type defining the basic structure of all FpML messages which is refined by its derived types.</xsd:documentation>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="Document"/>
</xsd:complexContent>
</xsd:complexType>


<xsd:complexType name="NotificationMessage" abstract="true">
<xsd:annotation>
<xsd:documentation xml:lang="en">A type defining the basic content for a message sent to inform another system that some 'business event' has occured. Notifications are not expected to be replied to.</xsd:documentation>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="Message">
<xsd:sequence>
<xsd:element name="header" type="NotificationMessageHeader"/>
<xsd:group ref="Validation.model"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>


<xsd:complexType name="ContractCreated">
<xsd:annotation>
<xsd:documentation xml:lang="en"> Notification that a Contract has been Created </xsd:documentation>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="NotificationMessage">
<xsd:sequence>
<xsd:element name="tradeReference" type="PartyTradeIdentifiers" minOccurs="0"/>
<xsd:element name="contract" type="Contract"/>
<xsd:element name="party" type="Party" minOccurs="2" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

Now assume an element is defined of type Document like below and used as input to decision service.

<xsd:element name="FpML" type="Document">

The compiler will report an invalid dictionary as it will not find a concrete definition at design time. To suppress this error follow below steps to tell compiler not to check for concrete definition at design time.



No comments:

Post a Comment

Demystifying OIC, OCI and Oracle SOA CS

What is OIC (Oracle integration cloud), OCI (Oracle cloud infrastructure), and SOA cloud service and how they are different? - This has bee...