setup drools Kie execution server credentials

Matías Rawlins Kunstmann picture Matías Rawlins Kunstmann · Oct 24, 2014 · Viewed 7.8k times · Source

I'm trying to setup the kie execution service (kie-server-services-6.2.0) for being provisioned by the kie-drools-wb-webapp-6.2.0, when I try to get access by following the webapp url of the execution server it shows a BASIC authentication, and don't know how to proceed for getting the access to the execution server, and also get the endpoint url, for provisioning the build-in rules examples of the kie-wb and get the REST or the WSDL working. The kie-wb has a username with role "admin" and I can build correctly the rules. Many thanks!!

Answer

Artem Zaika picture Artem Zaika · Jan 20, 2015

Trying to answer you question I decided to create HOWTO from the very beginning what I did to get my Drool rules executed on remote server.

My task was to integrate Kie Workbench and Execution Server, so business users be able to create Drools rules and deploy them to the Repo, while developers could use these rules via calling REST services of standalone Drools execution server.

You should follow these steps:

Before using Drools Execution Server let me use such terminology:

  • Kie Drools Workbench - is UI for creating and deploying Model and Rules file(s) to Maven Repository
  • Kie Execution Server - is standalone Drools execution server. It consumes REST calls of commands and returns execution results
  • Assumed you have Tomcat 7.0/8.0 and Maven installed

Deployment of Drools Workbench

Most stable version of Kie Drools Workbench to deploy at the moment is 6.1.0.Final. Use this one for deploying on Tomcat 7.0 only!

  • You can download file called kie-drools-wb-distribution-wars from Jboss sonar repo, use version 6.1.0.Final and tomcat7.war

  • Make sure you added following jars to Tomcat's lib directory: javax.security.jacc-api-1.4.jar, kie-tomcat-integration.jar, slf4j-api-1.7.2.jar

  • Make sure you have or added following roles/users to tomcat-users.xml of your Tomcat:

<role rolename="admin"/> <!-- Tomcat Admin role -->
<role rolename="analyst"/> <!-- Kie Workbench Analyst role. -->
<role rolename="kie-server"/> <!-- Kie Drools Execution Server role. Needed to make REST Rules execution request -->
<user username="admin" password="admin" roles="manager-gui,manager-script" /> <!-- Tomcat Admin user -->
<user username="user1" password="user1" roles="admin, kie-server" /> <!-- Kie Drools Execution Server user. Needed to make REST Rules execution request -->

  • Deploy tomcat7.war to Tomcat. I'm sure you know how to make it
  • Open link: http://localhost:8080/kie-drools-wb-distribution-wars-6.1.0.Final-tomcat7.0/. Use admin credentials configured in previous step to enter Workbench. In our case user1/user1
  • In Kie Workbench create a Model, Rules file. Validate them and click Deploy. Make sure you have jar file with your project being put to Maven repo!

    As an example you can use rule and model I created for testing purposes: Drool rule file:

    import com.arty.drlwb.MyExampleType;
    
    rule "one"
    when 
    MyExampleType(message == "Hello Worlddddd")
    then
    System.out.println("Hello World:)");
    end
    

Deployment of Kie Drools Execution Server

For the moment of this To-Do writing the most stable version of Kie Drools Execution Server is kie-server-services-6.2.0.Beta3.war. You can download it here, Jboss sonar repo:

    <response type="SUCCESS" msg="Kie Server info">
      <kie-server-info>
      <version>6.2.0.Beta3</version>
      </kie-server-info>
    </response>

<kie-container>
       <container-id>{your_container_id}</container-id>
       <status/> 
       <release-id>
            <group-id>{your_project_group_id}</group-id>
            <artifact-id>{your_project_artifact_id}</artifact-id>
            <version>{your_project_version}</version>
      </release-id>
     <resolved-release-id/>
</kie-container>

<response type="SUCCESS" msg="List of created containers">
 <kie-containers>
 <kie-container container-id="{your_container_id}" status="STARTED">
 <release-id>
<artifact-id>{your_project_artifact_id}</artifact-id>
<group-id>{your_project_group_id}</group-id>
<version>{your_project_version}</version>
</release-id>
 <resolved-release-id>
<artifact-id>{your_project_artifact_id}</artifact-id>
<group-id>{your_project_group_id}</group-id>
<version>{your_project_version}</version>
</resolved-release-id>
</kie-container>
</kie-containers>
</response>

Use XML format. of cause use your own model instead of MyExampleType:

<batch-execution lookup="defaultKieSession">
<insert out-identifier="message" return-object="true" entry-point="DEFAULT">
    <com.arty.drlwb.MyExampleType>
          <message>Hello Worlddddd</message>
    </com.arty.drlwb.MyExampleType>
</insert>
<fire-all-rules/>
</batch-execution>

  • Check your Tomcat console. If you get Hello World:) message and SUCCESS response type all works for you now!

P.S Due to luck of documentation about the topic I checked out Server's sources from GitHub. Take a look at kie-server-client and kie-server-integ-tests code and tests. Hope this helps.