cfdutoit's picture

Hi,

I had an interface with a REST client that used to work on ARIS 7. Since moving to ARIS 9, nothing seems to be co-operating :(

When you run the script it gives this error without adding the Jersey JAR files (even though Jersey 1.1 files can be found in the std lib on the ARIS instance):

I then add the JAR files, but get this error:

I have included a script to show the code for you to test.

Test code:

    try {
        var clientClass = Packages.com.sun.jersey.api.client.Client;
        var client = clientClass.create();
        //The next line should work for password sites, not required for this example
        //client.addFilter(new com.sun.jersey.api.client.filter.HTTPBasicAuthFilter("user", "password"));
        var webResource = client.resource("http://jsonplaceholder.typicode.com/posts/1");
        webResource.type("application/json");
/*      tried this as well with same result
        var type = new javax.ws.rs.core.MediaType.APPLICATION_JSON;
        webResource.type(type); */
        var response = webResource.get(Packages.com.sun.jersey.api.client.ClientResponse);
	    var output = response.getEntity(String.class);
	    var status = response.getStatus();
        Dialogs.MsgBox(status + ": " + output);
    }
    catch(e) {
        Dialogs.MsgBox(e.toString());
    }

Should result in JSON result (from a test website):

{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}

I have tried with the following scenarios with the same Initialisation error:

  • With my own Java coded JAR files using Jersey

    • Works in eclipse, but not in ARIS
  • Tried using the latest version of Jersey 2.22.1
  • Tried compiling with JDK 1.5, 1.6, 1.7 and 1.8 

What am I missing?

I would appreciate any help :)

Thank you,

Francois Du Toit
cfdutoit@gmail.com

Tags: ARIS Architect ARIS script export Java javascript 
Attachments:Binary Data JerseyTest.arx