[rules-users] RESTful Example

Qian, Tony Tony.Qian at progressive-medical.com
Wed Nov 25 08:37:18 EST 2009


All,

First, I apologize long email. I have a few questions on how to use RESTful web Service on Execution Server. I have read through the document and followed the instruction. I think I missed a few critical steps. Here are what I did.


1)      Created package, category, rule, a java class (Referral as fact).

Class Referral {

                String homeState;

                String servviceType;

                String stateLicenseNumber;

...

}

2)      Used Test Scenarios tool to test rule. Everything worked perfectly.

3)      Installed Execution Server in JBoss.

4)      Added a mytest.properties file under \drools-5.0-guvnor-standalone\jboss-4.2.3.GA\server\default\deploy\drools-server.war\WEB-INF\classes\

<change-set xmlns='http://drools.org/drools-5.0/change-set'";

        xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'

        xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-5.0.xsd' >

        <add>

          <resource source=http://localhost:8080/DroolsDemo_sfasdfasd.pkg type='PKG' />

        </add>

</change-set>

5)  Add jar file for above java class in lib directory.

6)      Created java class to call mytest RESTful service.


PostMethod method = new PostMethod("http://localhost:8080/drools-server/knowledgebase/mytest");
            method.setRequestHeader("Cache-Control", "no-cache");
            method.setRequestHeader("Accept","text/xml");
            method.setRequestHeader("Content-Encoding","UTF-8");
            try{

                  File f = new File("Request.xml");
            method.setRequestBody(new FileInputStream(f));

            }catch(Exception e){

            }



Request.xml content is:


<knowledgebase-request>
  <globals>
  </globals>
  <inOutFacts>
    <named-fact>
      <id>testFact</id>
      <fact class="Drools.ReferralDetail">
        <homeState>FL</homeState>
        <serviceType>HH</serviceType>
        <stateLicenseNumber></stateLicenseNumber>
      </fact>
    </named-fact>
  </inOutFacts>

</knowledgebase-request>



I got RuleBase mytest not known or is not valid.



Here are my questions:



1)      Did I miss any other steps? Anything I did wrong?

2)       If I run execution server on different server, where I should put pkg file and how to make necessary changes to mytest.properties?

Sorry for long email. Appreciate your help and Happy Holidays.

Tony

<HR>
<font size="1" face="Arial"><B>CONFIDENTIALITY NOTICE: </B>The information in this electronic transmission and
any documents accompanying it may contain confidential and privileged
information intended for use by the individual or entity that is the intended
recipient. If you have received this message in error or due to an unauthorized
transmission or interception, please delete all copies from your system without
disclosing, copying, or transmitting this message and notify us by telephone
877TELLUS9 or by electronic mail <a href = "servicecomments at progressive-medical.com">servicecomments at progressive-medical.com</a>.</font>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091125/50976920/attachment.html 


More information about the rules-users mailing list