This discussion is archived
2 Replies Latest reply: Jan 15, 2013 2:17 AM by LukeStudley RSS

OPA Rules Doc Compilation Error when we using custom function

927943 Newbie
Currently Being Moderated
Good Morning,

I am using OPA/OPM - 10.4.2.18 with CRMOD Connector, We are trying to install a custom function and use in our interview screens as mentioned in the steps of OPM Help documentation.

But it throws an error from Rules document while compilation.

Rules Document:+
Variable_number[sum]
[p2]Variable_number[b]
[p1]Variable_number[a]

the sum of two number is known if
a is known and
b is known

sum = add11(a,b)

Error:+
Error after text ‘sum=’. Found text:’add11(a,b)’.Expected value: expression, variable,constants(OPA-E00111)


Steps Followed:+

1.Created Rules document in OPM as above.
2.Updated extension.xml with custom function added, Kindly advice namespaces/xsd (ie. http://tempuri.org/extension.xsd) mentioned in extension.xml is correct?
And also advice whether Custom function: “add11” installed is correctly mentioned or not in the below extension xml.

Is it necessary to add package/class name/class path in the xml, so that it works / compiles rules doc correctly? Kindly advice.

3.We have built jar with the below sample class (adding two numbers) and copied JAR to \lib folder as mentioned in help documentation
=================================================================================

Extension.xml+

<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified"
xmlns:mstns="http://tempuri.org/Extension.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:simpleType name="value-type">
<xs:enumeration value="number"/>
</xs:simpleType>

<xs:simpleType name="platform-type">
<xs:enumeration value="java"/>
</xs:simpleType>

<xs:element name="extension">
<xs:complexType>
<xs:sequence>
<xs:element name="functions" minOccurs="0" maxOccurs="1">
<xs:complexType>
                         <xs:sequence>
<xs:element ref="main" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="add11" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="add11">
<xs:complexType>
<xs:sequence>
<xs:element ref="arg" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="handler" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="sum11" type="number" use="required"/>
<xs:attribute name="return-type" type="value-type" use="required"/>
</xs:complexType>
</xs:element>

<xs:element name="arg">
<xs:complexType>
          <xs:attribute name="b" type="number" use="required"/>
<xs:attribute name="a" type="number" use="required"/>
</xs:complexType>
</xs:element>

<xs:element name="handler">
<xs:complexType>
<xs:attribute name="platform" type="platform-type" use="required"/>
<xs:attribute name="class" type="number" use="required"/>
</xs:complexType>
</xs:element>

<xs:element name="property">
<xs:complexType>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="value" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
=============================================================================

Java class with custom function+


package addingTwoNumbers;

public class Summing {

     /**
     * @param args
     */
     public static void main(String[] args) {
          int b = 10;
          int a = 29;
          int sum11 = add11(a, b);
          System.out.println(sum11);
     }

     static int add11(int a, int b) {
          return a + b;
     }

}

========================
*
Regards
Bhaskara Reddy Sannapureddy
bhaskara.sannapureddy@crmit.com
+91-9008466722
*

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points