Use wsadminlib's method setServerPort(). Here's an example of setting the web container's default port:
nodename = 'node1'
servername = 'server1'
endPointName = 'WC_defaulthost'
port = 9083
setServerPort(nodename, servername, endPointName, port)
Note that the name arguments are python strings, but the port is a number. Here is a screenshot:
root@ding6 /opt/WAS70/bin/wsadmin.sh -lang jython -host ding6 -port 8879
WASX7209I: Connected to process "dmgr" on node dmgr using SOAP connector; The type of process is: DeploymentManager
WASX7031I: For help, enter: "print Help.help()"
wsadmin>
wsadmin>execfile('wsadminlib.py')
$Id: wsadminlib.py 50 2009-01-14 14:42:11Z ding $
wsadmin>
wsadmin>enableDebugMessages()
[2010-0301-1232-1200] enableDebugMessages Verbose trace messages are now enabled; future debug messages will now be printed.
wsadmin>
wsadmin>
wsadmin>nodename = 'node1'
wsadmin>servername = 'server1'
wsadmin>endPointName = 'WC_defaulthost'
wsadmin>port = 9083
wsadmin>
wsadmin>setServerPort(nodename, servername, endPointName, port)
wsadmin>
Option: If you look at the method signature, you'll see that a hostname parameter (or IP) can be specified for this port definition. It defaults to the asterisk wildcard. For example,
wsadmin>hostname = 'ding6.raleigh.ibm.com'
wsadmin>setServerPort(nodename, servername, endPointName, port, hostname)
wsadmin>
Also note this method is not very chatty, since it prints no messages on success. You'll find differences in verbosity throughout wsadminlib, depending upon who wrote the method. Fear not, most setters have getters, and you can query the value after setting it:
wsadmin>getServerPort(nodename, servername, endPointName)
'9083'
wsadmin>