Hi,

Using the following code, I can fetch the packages from Guvnor using Rest API (source) but How can I next create a KnowledgeBuilder based on the source of Packages retrieved ?

My idea is to use ResourceFactory.

        // Fetch Packages from Guvnor
        URL url = new URL("http://127.0.0.1:8080/guvnor.war/rest/packages/mortgages/source");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestProperty("Authorization",
                "Basic " + new Base64().encodeToString(("admin:admin".getBytes())));
        connection.setRequestMethod("GET");
        connection.setRequestProperty("Accept", MediaType.WILDCARD);
        connection.connect();

        System.out.println("ResponseCode: " + connection.getResponseCode());
        System.out.println("MediaType: " + connection.getContentType());
        
        String packages = IOUtils.toString(connection.getInputStream());
        InputStream is = connection.getInputStream();

Regards,

--
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com