Example: Migrating - Modifying Web container port numbers
These examples demonstrate how to modify Web container HTTP transport ports for WAS V5.x and V6.x.
Use the following examples:
- wsadmin V5.x Using Jacl:
set httpPort 7575 set server [$AdminConfig getid /Cell:myCell/Node:myNode/Server:server1/] set transports [$AdminConfig list HTTPTransport $server] set transport [lindex $transports 0] set endPoint [$AdminConfig showAttribute $transport address] $AdminConfig modify $endPoint [list [list port $httpPort]] $AdminConfig saveUse Jython:
httpPort = 7575 server = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:server1/") transports = AdminConfig.list("HTTPTransport", server).split(java.lang.System.getProperty("line.separator")) transport = transports[0] endPoint = AdminConfig.showAttribute(transport, "address") AdminConfig.modify(endPoint, [["port", httpPort]]) AdminConfig.save()
- wsadmin V6.x Using Jacl:
set serverNm server1 set newPort 7575 set node [$AdminConfig getid /Cell:myCell/Node:myNode/] set TCS [$AdminConfig getid /Cell:myCell/Node:myNode/Server:server1/TransportChannelService:/] set chains [$AdminTask listChains $TCS {-acceptorFilter WebContainerInboundChannel}] foreach chain $chains { set channels [lindex [$AdminConfig showAttribute $chain transportChannels] 0] foreach channel $channels { if {[catch {set channelEndPointName [$AdminConfig showAttribute $channel endPointName]} result]} { # ignore the error as not all channel has endPointName attribute } else { set serverEntries [$AdminConfig list ServerEntry $node] foreach serverEntry $serverEntries { set sName [$AdminConfig showAttribute $serverEntry serverName] if {$sName == $serverNm} { set specialEndPoints [lindex [$AdminConfig showAttribute $serverEntry specialEndpoints] 0] foreach specialEndPoint $specialEndPoints { set endPointNm [$AdminConfig showAttribute $specialEndPoint endPointName] if {$endPointNm == $channelEndPointName} { set ePoint [$AdminConfig showAttribute $specialEndPoint endPoint] $AdminConfig modify $ePoint [list [list port $newPort]] break } } } } } } } $AdminConfig saveUse Jython:
serverNm = "server1" newPort = "7575" node = AdminConfig.getid("/Cell:myCell/Node:myNode/") TCS = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:server1/TransportChannelService:/") chains = AdminTask.listChains(TCS, "[-acceptorFilter WebContainerInboundChannel]").split(java.lang.System.getProperty("line.separator")) for chain in chains: channelString = AdminConfig.showAttribute(chain, "transportChannels") channelList = channelString[1:len(channelString)-1].split(" ") for channel in channelList: try: channelEndPointName = AdminConfig.showAttribute(channel, "endPointName") serverEntries = AdminConfig.list("ServerEntry", node).split(java.lang.System.getProperty("line.separator")) for serverEntry in serverEntries: sName = AdminConfig.showAttribute(serverEntry, "serverName") if sName == serverNm: sepString = AdminConfig.showAttribute(serverEntry, "specialEndpoints") sepList = sepString[1:len(sepString)-1].split(" ") for specialEndPoint in sepList: endPointNm = AdminConfig.showAttribute(specialEndPoint, "endPointName") if endPointNm == channelEndPointName: ePoint = AdminConfig.showAttribute(specialEndPoint, "endPoint") AdminConfig.modify(ePoint, [["port", newPort]]) break except: # ignore the error as not all channel has endPointName attribute pass AdminConfig.save()
Related tasks
Migrating administrative scripts
Reference topic