PQ73919: WebSphere v4.0.x InfoCenter: Section 6.6.0.2.2.7 states incorrect information

APAR status
Closed as documentation error.

Error description
The below section is from the InfoCenter:
--------------------------------------------------------------
6.6.0.2.2.7: Using the wscpCommand interface

Public methods
WscpResult evalCommand(String command)

This method evaluates a wscp operation and returns the results.
Use the same syntax as you do for interactive or scripted wscp
operations. Using abbreviated command names is not recommended.

The results of the evalCommand method are encoded in a
com.ibm.ejs.sm.ejscp.wscpcommand.WscpResult object. The
following methods on this object can be used to evaluate the
returned value:


toString-- Returns a string representation of the results of the
wscp operation.
Note:
The WscpCommand interface has no way of knowing the format of
the expected output from a wscp operation. When the return
format is not an attribute-value pair or list, use the toString
method to evaluate the output. The application programmer must
then write code to parse the output.

success-- Returns a boolean value indicating whether the wscp
operation was successful.

listToVector-- If the expected result of the wscp operation is a
list, use this method to return a vector containing the list
elements.

attribPairsToVector-- If the expected result of the wscp
operation is a list of attribute-value pairs, use this method to
return a vector containing the list. Each element of the vector
is an attribute-value pair.

attribPairsToHashTable-- If the expected result of thewscp
operation is a set of attribute-value pairs, use this method to
return a hash table containing the values keyed on the
attributes.
String getErrorInfo()

This method returns the status of an evalCommand method whose
results are returned in a WscpResult object.


If the wscp operation specified in the evalCommand executed
successfully, the getErrorInfo method returns an empty string.

If the wscp operation did not execute successfully, the
getErrorInfo method returns the exception information that was
received from wscp.
The following is an example of how to use the evalCommand and
getErrorInfo methods.

String cmd = "ApplicationServer list";
WscpResult results = wscpCommand.evalCommand(cmd);
if (!results.success()) {
System.out.println("command failed; exception information: " +
results.getErrorInfo());
}
--------------------------------------------------------------

The above does not work, from Level 3 the following was tested
by the customer and does work:

It seems that the WscpCommand object is meant to be instantiated
once and reuse the object to successively poll the WebSphere
Admin Server.

Currently there are two instantiations of the WscpCommand object
in ListeWebModuleServlet.java.  One in refreshConfig(), another
in refreshStatus().  Looks like the first instantiation of
WscpCommand is interfering with the second WscpCommand calls.

So please try make the following changes in
ListeWebModuleServlet.java:
(1) In refreshStatus() and refreshConfig() methods:
comments out the "WscpCommand command = new wscpCommand()"
statements
(2) In doPost() method, add the "WscpCommand command = new
wscpCommand()" statement, before calling refreshStatus() and
refreshConfig()
(2) Pass "command" object instantiated in doPost() to
refreshStatus()
and refreshConfig() calls.

Here are pieces of what the code looks like after the above
changes:

public void doPost(
    .....
    WscpCommand command = new WscpCommand();   // change (2)
    message = refreshConfig(config, command);  // change (3)
    message = refreshStatus(config, command);  // change (3)
    .....
}

protected String refreshConfig(Hashtable config, WscpCommand
command) {
    .....
    //WscpCommand command = new WscpCommand();  // change (1)
    WscpResult result =
command.evalCommand(WscpConstants.LIST_MODULE);
    .....
Local fix
}

protected String refreshStatus(Hashtable config, WscpCommand
command) {
    .....
    //WscpCommand command = new WscpCommand( );  // change (1)
    .....
    String cmd = "Module show {/EnterpriseApp:"......
    WscpResult result = command.evalCommand(cmd);
}
LOCAL FIX:
none - document needs to be updated
Problem summary
****************************************************************
* USERS AFFECTED: Users of WebSphere Application Server        *
*                 Version 4.0.                                 *
****************************************************************
* PROBLEM DESCRIPTION: Customers who attempt to use the        *
*                      wscpCommand interface to instantiate    *
*                      and reuse the object to successively    *
*                      poll the WebSphere Administrative       *
*                      Server are not successful.              *
****************************************************************
* RECOMMENDATION:                                              *
****************************************************************
The article 060600020207.html was updated in the examples to
show how the WSCP command should be used so that the first
instantiation of the command does not interfere with the other
WSCPCommand calls:
For example:
The following is an example of how to use the evalCommand and
getErrorInfo methods.
String cmd = "ApplicationServer list";
WscpResult results = wscpCommand.evalCommand(cmd);
if (!results.success()) {
System.out.println("command failed; exception information: " +
results.getErrorInfo());
}
and An example of how this class is used is as follows:
String name = "{/Node:MyNode/ApplicationServer:MyAppServer/}"
WscpQualfiedName qName = new WscpQualifiedName(name);
qName.numberOfLevels() returns 2
qName.getObject(2) returns "ApplicationServer"
qName.getName(2) returns "MyAppServer"
qName.getName(WscpQualifiedName.APPLICATION_SERVER)
returns "MyAppServer"
Problem conclusion
Close this APAR as a documentation change.
The information is currently available in the WebSphere
Application Server Version 4.0.6 InfoCenter.
Temporary fix Comments
APAR information
APAR number PQ73919
Reported component name WEBSPHERE AE NT
Reported component ID 5630A2201
Reported release 400
Status CLOSED DOC
PE NoPE
HIPER NoHIPER
Submitted date 2003-05-07
Closed date 2003-06-24
Last modified date 2004-06-03

APAR is sysrouted FROM one or more of the following:

APAR is sysrouted TO one or more of the following:

Modules/Macros

Fix information

Applicable component levels


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > General
Operating system(s):
Software version: 400
Software edition:
Reference #: PQ73919
IBM Group: Software Group
Modified date: Jun 3, 2004