Hi Rao,
I get an error when trying the script you provided
def env = ['test', 'sandbox']
def connName = ['wba', 'vb', 'cnx', 'rb', 'subinfo']
def xml = '''<connStrings><env name="test"><conn><connName>wba</connName><host>host01</host><port>1500</port><user>wbauser</user><password>wbapassword</password><sid>test</sid></conn><conn><connName>vb</connName><host>host02</host><port>1500</port><user>vbuser</user><password>vbpassword</password><sid>test</sid></conn><conn><connName>cnx</connName><host>host03</host><port>1500</port><user>cnxuser</user><password>cnxpassword</password><sid>test</sid></conn><conn><connName>rb</connName><host>host04</host><port>1500</port><user>rbuser</user><password>rbpassword</password><sid>test</sid></conn></env><env name="sandbox"><conn><connName>wba</connName><host>host01</host><port>1500</port><user>wbauser</user><password>wbapassword</password><sid>sandbox</sid></conn><conn><connName>vb</connName><host>host02</host><port>1500</port><user>vbuser</user><password>vbpassword</password><sid>sandbox</sid></conn><conn><connName>cnx</connName><host>host03</host><port>1500</port><user>cnxuser</user><password>cnxpassword</password><sid>sandbox</sid></conn><conn><connName>subinfo</connName><host>host03</host><port>1500</port><user>subinfouser</user><password>subinfopassword</password><sid>sandbox</sid></conn></env></connStrings>'''
def connStrings = new XmlSlurper().parseText(xml)
//Get details of test environment
def testConnectionDetails = getConnectionDetails(connStrings, env[0], connName)
showConnectionDetails(testConnectionDetails, env[0], connName)
//Get details of sandbox environment
def sandboxConnectionDetails = getConnectionDetails(connStrings, env [1], connName)
showConnectionDetails(sandboxConnectionDetails, env[1], connName)
And the error is
groovy.lang.MissingMethodException: No signature of method: Script8.getConnectionDetails(is applicable for argument types: (groovy.util.slurpersupport.NodeChild, java.lang.String, java.util.ArrayList) values: [wbahost011500wbauserwbapasswordtestvbhost021500vbuservbpasswordtestcnxhost031500cnxusercnxpasswordtestrbhost041500rbuserrbpasswordtestwbahost011500wbauserwbapasswordsandboxvbhost021500vbuservbpasswordsandboxcnxhost031500cnxusercnxpasswordsandboxsubinfohost031500subinfousersubinfopasswordsandbox, ...] error at line: 6
Also, what I really want to accomplish is that if I ever have to add a new connection the Groovy script does not need to be changed and all I would have to edit is the XML file. I have attached the script that I am currently using so you can see what I have so far.