OK, if the XML is not hard-coded as it was on your first example, then the syntax is a little bit different.
var request = nsx_host.createRequest("GET", "/2.0/vdn/virtualwires", null); var strBasicAuthentication; strBasicAuthentication = "***"; request.setHeader("Accept","application/*+xml;version=5.6"); request.setHeader("Content-Type","application/xml"); request.setHeader("Authorization","Basic " + strBasicAuthentication); var response = request.execute(); org_list = response.contentAsString; var doc = new XML(org_list); // construct XML document from dynamic string value for each (var wire in doc.dataPage.virtualWire) { System.log("wire --> objectId: " + wire.objectId + " name: " + wire.name); }