Hi All,
I have a problem with rule mediator. I defined input facts and i try to
callout a java method with facts as arguments but i have an error when
deploying proxy :
Error during creating rule set: Rule Compilation error : [Rule name='test
rule']
com/example/rule/Rule_test_rule1466459032.java (13:83) : Unknown
variable
or type "Kwota_Inwestycji"
com/example/rule/Rule_test_rule1466459032.java (13:97) : Unknown
variable
or type "Rate_Up_Front"
com/example/rule/Rule_test_rule1466459032.java (13:112) : Unknown
variable
or type "Assumed_Return"
com/example/rule/Rule_test_rule1466459032.java (13:127) : Unknown
variable
or type "Czasokres_MTHS"
com/example/rule/Rule_test_rule1466459032.java (13:147) : Unknown
variable
or type "Rate_Redemption_Fee"
com/example/rule/Rule_test_rule1466459032.java (13:160) : Unknown
variable
or type "Rate_mgm_Fee"
com/example/rule/Rule_test_rule1466459032.java (13:176) : Unknown
variable
or type "Rate_Cost_Other"
com/example/rule/Rule_test_rule1466459032.java (13:193) : Unknown
variable
or type "Rate_Distributor"
com/example/rule/Rule_test_rule1466459032.java (13:210) : Unknown
variable
or type "Rate_Success_Fee"
com/example/rule/Rule_test_rule1466459032.java (13:224) : Unknown
variable
or type "Czasokres_YRS"
com/example/rule/Rule_test_rule1466459032.java (13:66) : No applicable
constructor/method found for actual parameters "java.lang.Object,
java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object,
java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object,
java.lang.Object"; candidates are: "float com.mifdi.MIFDI.getResult(double,
double, double, double, double, double, double, double, double, double)"
I tried to define them like that in rule after when :
<brs:ruleSet>
<brs:properties/>
<brs:rule resourceType="regular" sourceType="inline">
package com.example.rule
//list imports here
import com.mifdi.MIFDI;
//declare any global variables here
rule "test rule"
when
Kwota_Inwestycji: Double()
Rate_Up_Front: Double()
Assumed_Return: Double()
Czasokres_MTHS: Double()
Rate_Redemption_Fee: Double()
Rate_mgm_Fee: Double()
Rate_Cost_Other: Double()
Rate_Distributor: Double()
Rate_Success_Fee: Double()
Czasokres_YRS: Double()
Calculate: String()
eval( Calculate.equals("true") )
then
update(drools.getWorkingMemory().getFactHandle(Result),);
System.out.println("----------------------" +
MIFDI.getResult(Kwota_Inwestycji,Rate_Up_Front,Assumed_Return,Czasokres_MTHS,Rate_Redemption_Fee,Rate_mgm_Fee,Rate_Cost_Other,Rate_Distributor,Rate_Success_Fee,Czasokres_YRS)
+ "------");
end
</brs:rule>
After that i might be able to deploy my proxy but when i Invoke that proxy i
got end of memory and my EI is not responding. I have tested my java class
and its not a problem.
I noticed that when I define only 2 facts after when and i did only pritntl
on then i have println 10 times in logs
:
<brs:rule xmlns:brs="http://wso2.org/carbon/rules">
<brs:source>$INPUT</brs:source>
<brs:target xpath="" resultXpath=""
action="replace">$OUTPUT</brs:target>
<brs:ruleSet>
<brs:properties/>
<brs:rule resourceType="regular" sourceType="inline">
package com.example.rule
//list imports here
import com.mifdi.MIFDI;
//declare any global variables here
rule "test rule"
when
Kwota_Inwestycji: Double()
Calculate: String()
eval( Calculate.equals("true") )
then
System.out.println("----------------------");
end
</brs:rule>
</brs:ruleSet>
Where i should define types of facts? How should it be done ?
below my source code :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="MIFIDBussinessRules"
transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<property xmlns:ns0="MIDIF" name="INPUT"
expression="//ns0:Request" scope="default" type="OM"/>
<log level="full"/>
<brs:rule xmlns:brs="http://wso2.org/carbon/rules">
<brs:source>$INPUT</brs:source>
<brs:target xpath="" resultXpath=""
action="replace">$OUTPUT</brs:target>
<brs:ruleSet>
<brs:properties/>
<brs:rule resourceType="regular" sourceType="inline">
package com.example.rule
//list imports here
import com.mifdi.MIFDI;
//declare any global variables here
rule "test rule"
when
Kwota_Inwestycji: Double()
Rate_Up_Front: Double()
Assumed_Return: Double()
Czasokres_MTHS: Double()
Rate_Redemption_Fee: Double()
Rate_mgm_Fee: Double()
Rate_Cost_Other: Double()
Rate_Distributor: Double()
Rate_Success_Fee: Double()
Czasokres_YRS: Double()
Calculate: String()
eval( Calculate.equals("true") )
then
update(drools.getWorkingMemory().getFactHandle(Result),);
System.out.println("----------------------" +
MIFDI.getResult(Kwota_Inwestycji,Rate_Up_Front,Assumed_Return,Czasokres_MTHS,Rate_Redemption_Fee,Rate_mgm_Fee,Rate_Cost_Other,Rate_Distributor,Rate_Success_Fee,Czasokres_YRS)
+ "------");
end
</brs:rule>
</brs:ruleSet>
<brs:input namespace="MIDIF" wrapperElementName="facts">
<brs:fact xmlns:ns0="MIDIF" elementName="Calculate"
namespace="MIDIF" type="java.lang.String" xpath="//ns0:Calculate"/>
<brs:fact xmlns:ns0="MIDIF"
elementName="Kwota_Inwestycji" namespace="MIDIF" type="java.lang.Double"
xpath="//ns0:Kwota_Inwestycji"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Rate_Up_Front"
namespace="MIDIF" type="java.lang.Double" xpath="//ns0:Rate_Up_Front"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Assumed_Return"
namespace="MIDIF" type="java.lang.Double" xpath="//ns0:Assumed_Return"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Czasokres_MTHS"
namespace="MIDIF" type="java.lang.Double" xpath="//ns0:Czasokres_MTHS"/>
<brs:fact xmlns:ns0="MIDIF"
elementName="Rate_Redemption_Fee" namespace="MIDIF" type="java.lang.Double"
xpath="//ns0:Rate_Redemption_Fee"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Rate_mgm_Fee"
namespace="MIDIF" type="java.lang.Double" xpath="//ns0:Rate_mgm_Fee"/>
<brs:fact xmlns:ns0="MIDIF"
elementName="Rate_Cost_Other" namespace="MIDIF" type="java.lang.Double"
xpath="//ns0:Rate_Cost_Other"/>
<brs:fact xmlns:ns0="MIDIF"
elementName="Rate_Distributor" namespace="MIDIF" type="java.lang.Double"
xpath="//ns0:Rate_Distributor"/>
<brs:fact xmlns:ns0="MIDIF"
elementName="Rate_Success_Fee" namespace="MIDIF" type="java.lang.Double"
xpath="//ns0:Rate_Success_Fee"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Czasokres_YRS"
namespace="MIDIF" type="java.lang.Double" xpath="//ns0:Czasokres_YRS"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Result"
namespace="MIDIF" type="java.lang.Float" xpath="//ns0:Result"/>
</brs:input>
<brs:output namespace="MIDIF" wrapperElementName="out">
<brs:fact elementName="Result" namespace="MIDIF"
type="java.lang.Float"/>
</brs:output>
</brs:rule>
<log level="full">
<property name="OUTPUT"
expression="get-property('OUTPUT')"/>
</log>
<loopback/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
--------------------------------
Request to invoke proxy :
<ns0:Request xmlns:ns0="MIDIF">
<ns0:Calculate>true</ns0:Calculate>
<ns0:Kwota_Inwestycji>1000</ns0:Kwota_Inwestycji>
<ns0:Rate_Up_Front>2.70</ns0:Rate_Up_Front>
<ns0:Assumed_Return>0.00</ns0:Assumed_Return>
<ns0:Czasokres_MTHS>60</ns0:Czasokres_MTHS>
<ns0:Rate_Redemption_Fee>0.50</ns0:Rate_Redemption_Fee>
<ns0:Rate_mgm_Fee>4.00</ns0:Rate_mgm_Fee>
<ns0:Rate_Cost_Other>0.15</ns0:Rate_Cost_Other>
<ns0:Rate_Distributor>0.00</ns0:Rate_Distributor>
<ns0:Rate_Success_Fee>10.00</ns0:Rate_Success_Fee>
<ns0:Czasokres_YRS>5.00</ns0:Czasokres_YRS>
<ns0:Result></ns0:Result>
</ns0:Request>
--------------------------------
Thanks,
Melodies
--
Sent from: http://wso2-oxygen-tank.10903.n7.nabble.com/WSO2-Development-f3.html
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev