I want to be able to get the error, success and ticket attributes (not userid) from the response element but I haven't had much luck so far as I'm fairly new to this stuff. How should I go about doing this?
Thanks,
Luke.
Edit:
Got it working now.
Code: Select all
importPackage(com.ebasetech.xi.api);
importPackage(com.ebasetech.xi.services);
try {
// call the web service.
resources.IRWS_AUTHENTICATEUSER.call();
resources.IRWS_AUTHENTICATEUSER.fetch();
}
catch (e) {
event.owner.addErrorMessage(e.javaException.message);
}
//get the response document
var response = resources.IRWS_AUTHENTICATEUSER.getDocument("Response");
var xmlDoc = new XML(response);
// variable xmlResponse get the response element from the response document
var xmlResponse = xmlDoc.child(0).child("response");
// now get the attrubutes error, ticket and success from the response element.
fields.RESPONSE_ERROR.value = xmlResponse.attribute("error").toString();
fields.RESPONSE_TICKET.value = xmlResponse.attribute("ticket").toString();
fields.RESPONSE_SUCCESS.value = xmlResponse.attribute("success").toString(); // this is a boolean field set to checkbox