Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Querying server host and port using jython and wsadmin

19 views
Skip to first unread message

duncan.m...@ca.com

unread,
Apr 11, 2008, 1:34:52 PM4/11/08
to
Is it possible to write a jython script to be run by wsadmin which will return the host name and port used by a WebSphere server (specifically host and port for WCInboundDefault channel on WAS 6.0 and WAS 6.1)? If so, could you point me to an example?<br />
Many thanks

Ken Hygh

unread,
Apr 11, 2008, 3:11:54 PM4/11/08
to
duncan.m...@ca.com wrote:
> Is it possible to write a jython script to be run by wsadmin which will return the host name and port used by a WebSphere server (specifically host and port for WCInboundDefault channel on WAS 6.0 and WAS 6.1)? If so, could you point me to an example?<br />
> Many thanks
>
No. You have to know the hostname & port to connect wsadmin to.

Ken

Duncan.M...@ca.com

unread,
Apr 11, 2008, 4:52:39 PM4/11/08
to
Ken<br />
Thanks. Unfortunately I see now my question was not quite precise enough! I'm installing into a Network Deployment installation which contains multiple servers. What I want my jython script to do is return the host and port for each of the servers within the cell - not the SOAP port used by wsadmin but the host and port (i.e. those which correspond to WCInboundDefault) which can be used to access the pages within the application I've just deployed. I hope that makes sense.<br />
Duncan

Ken Hygh

unread,
Apr 12, 2008, 8:06:27 AM4/12/08
to
Duncan,
Sorry I misunderstood your question.
Mark Lewis posted a jacl solution for this on Feb 20, you might be able
to use it as a starting point if no one else contributes a working script.

Ken

Duncan.M...@ca.com

unread,
Apr 13, 2008, 4:35:43 AM4/13/08
to
Ken

Thanks. I'm probably doing something wrong (being new around here) but I've been through what appears to be all posts from Feb 20 and don't see one by Mark Lewis. Could you post the URL to that thread - or at least the title so I can search for it?

Duncan

Ken Hygh

unread,
Apr 13, 2008, 7:19:54 AM4/13/08
to

Duncan.M...@ca.com

unread,
Apr 14, 2008, 6:57:08 AM4/14/08
to
Apologies for formatting of above code - it looked OK in preview, but seems the second and third 'for' statements where not indented properly once I posted the code. Indent them to level of statement above each of them and it should work.

Duncan.M...@ca.com

unread,
Apr 14, 2008, 6:53:18 AM4/14/08
to
Ken

Thanks very much, there was an extra space in the URL but having removed that the script was just what I needed. In case it helps anyone else, I've translated Mark's script from JACL to Jython as follows:

# can 't use splitlines() with WAS 6.0, so break lines with split(lineSeparator)
lineSeparator = java.lang.System.getProperty( &quot;line.separator&quot; )
&nbsp;
nodes=AdminConfig.list( &quot;Node&quot; ).split(lineSeparator)
for node in nodes:
nodeName = AdminConfig.showAttribute(node, &quot;name&quot; )
serverEntries = AdminConfig.list( &quot;ServerEntry&quot; , node).split(lineSeparator)
for serverEntry in serverEntries:
serverName = AdminConfig.showAttribute(serverEntry, &quot;serverName&quot; )
print
print &quot;Node:&quot; +nodeName+ &quot;/Server:&quot; +serverName
namedEndPoints = AdminConfig.list( &quot;NamedEndPoint&quot; , serverEntry).split(lineSeparator)
for namedEndPoint in namedEndPoints:
endPointName = AdminConfig.showAttribute(namedEndPoint, &quot;endPointName&quot; )
endPoint = AdminConfig.showAttribute(namedEndPoint, &quot;endPoint&quot; )
host = AdminConfig.showAttribute(endPoint, &quot;host&quot; )
port = AdminConfig.showAttribute(endPoint, &quot;port&quot; )
print endPointName+ &quot;: &quot; +host+ &quot;:&quot; +port


Thanks again Ken for all your help.

0 new messages