Consume web service from ARIS report/macro

Translate this pagebookmark or share this page
Allen's picture

Posted: 2012-03-30
1232 views | 2 comments | category: ARIS Community

2
show all articles

Hello ARIS Community,

I am working on retrieving data from a web service.  I have created a jar file that will allow me to retrieve this data.  Following some advice on this site on how to make a jar file available to ARIS script, I placed the jar file in the \server\lib directory.

This works great for report script and functions as I expected.  When I try to use in a macro, however, it does not work.  I tried importing the jar file in script Common files and then go into the properties of the macro and checked to import the jar file.  This got me a little further, but now I get a message about "class com.test.webservices.Authenticate do not have a property of the name {http://webservices.test.com}Login".  Can someone explain why this error is coming up?  I am not using the method Authenticate in my script.

// Import the webservice jar file has to be in \server\lib directory
var imp = JavaImporter(Packages.webserviceconsumer);

// Call main otherwise nothing will happen
main();

// Main function
function main() {
    Dialogs.MsgBox("TEST!");

    // Obtain result of searching by email...testing hard-coded email address search
    var result = imp.WebserviceConsumer.searchByEmail("Allen@test.com");
    // Get object that holds basic info
    var identite = result.getIdentite();
    // Get object that holds contact info
    var coordonnee = result.getCoordonnee();
    // Create string to display some info
    var msg = "First name:     " + identite.getFirstName() + "\n" +
              "Last name:     " + identite.getLastName() + "\n" +
              "Tel:          " + coordonnee.getTel() + "\n" +
              "Email:        " + coordonnee.getMail();
    // Display message box with personnel info              
    Dialogs.MsgBox(msg, Constants.MSGBOX_BTN_OK, "Contact Info");
}

Thanks for your response.

Regards,

Allen

Comments
Francois's picture

Hi Allen,

You should look at putting the jar file on the client's machine as any macro runs on the client and not on the server... Just a thought, have not done something like this myself... :)

Rgs,
Francois

Allen's picture

Thanks for the suggestion, Francois.  I tried putting the jar file on the client machine and set the PATH.  Running the macro gives the same error. 

I thought that importing in the macro itself would make the jar file available at runtime?

Regards,

Allen