Hi All - I have just started with VCO. I am using the SOAP plugin however I am having problems placing the output of a specific attribute into an output variable.
The Current script below runs and generates a list of outputs in the log. I have tried the getOutParameter function but this seems to generate a NULL value. I am trying to output the attribute first_name which does exist and is populated.
var host = Server.findForType("SOAP:Host", "ee7e2701-a2d1-4107-a5ca-7eec77e35ec0");
if (host == null) throw "Host 'ee7e2701-a2d1-4107-a5ca-7eec77e35ec0' not found!";
var operation = host.getOperation("getRecords");
if (operation == null) throw "Operation 'getRecords' not found!";
function formatDate(inDate){
if (!inDate) {
return null;
}
dateRfc822 = System.formatDate(inDate, "yyyy-MM-dd'T'HH:mm:ssZ")
return dateRfc822;
}
System.log("creating request...");
var request = operation.createSOAPRequest();
request.setInParameter("last_name",last_name);
System.log("invoking '" + operation.name + "' operation...");
var response = operation.invoke(request);
System.log("operation '" + operation.name + "' successfully invoked.");
System.log("processing response...");
var result = new Properties();
System.log("out headers...");
outHeaders = System.getModule("com.vmware.library.soap").processOutHeaders(response);
System.log("out parameters...");
outParameters = System.getModule("com.vmware.library.soap").processOutParameters(response);
RESPONSE OUTPUT ( Trimmed)
[2014-12-09 22:32:27.758] [I] creating request...
[2014-12-09 22:32:27.758] [I] invoking 'getRecords' operation...
[2014-12-09 22:32:28.144] [I] operation 'getRecords' successfully invoked.
[2014-12-09 22:32:28.145] [I] processing response...
[2014-12-09 22:32:28.145] [I] out headers...
[2014-12-09 22:32:28.162] [I] out parameters...
[2014-12-09 22:32:28.169] [I] out parameters available:
[2014-12-09 22:32:28.176] [I] + parameter name: 'getRecordsResult[0].first_name', value: '<first_name>taz2150</first_name>'
[2014-12-09 22:32:28.217] [I] + parameter attribute name: '.(xmlns)', value: 'http://www.service-now.com/sys_user'
.