If you use .../assets/decisiontable1/source you get DRL and not the XLS. You can then use ResourceType.DRL.

Mentioning because if the name of the asset is a variable (and who knows, perhaps not always a XLS) you won't need to change your code.


On 10 April 2013 15:34, ciberg2 <joaoguerra72@gmail.com> wrote:
I managed to get it working thanks to your (precious) help.

I ended up with this code (I put it here so it can help someone in the
future):
    public static KnowledgeBase readKnowledgeBase(String decisionTable)
            throws Exception {
        UrlResource resource = (UrlResource) ResourceFactory

.newUrlResource("http://localhost:8080/drools-guvnor/rest/packages/myPackage/assets/decisiontable1/binary");
        resource.setBasicAuthentication("enabled");
        resource.setUsername("guest");
        resource.setPassword("guest");
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
                .newKnowledgeBuilder();
        kbuilder.add(resource, ResourceType.DTABLE);
        KnowledgeBase kbase = kbuilder.newKnowledgeBase();
        kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
        return kbase;
    }

Changed the URL to
http://localhost:8080/drools-guvnor/rest/packages/myPackage/assets/decisiontable1/binary
and ResourceType to DTABLE.

In my real implementation the name of the asset will be a variable of
course.



--
View this message in context: http://drools.46999.n3.nabble.com/Fire-specific-rules-deployed-in-guvnor-that-reside-in-the-same-package-tp4023266p4023298.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users