*/
public String process (String[] args) throws Exception
{
StringBuffer sb = new StringBuffer();
Options opts = new Options( args );
if (opts.isFlagSet('d') > 0) {
// Set log4j properties... !!!
}
args = opts.getRemainingArgs();
if ( args == null ) {
log( "Usage: AdminClient xml-files | list" );
return null;
}
for ( int i = 0 ; i < args.length ; i++ )
{
InputStream input = null;
if ( args[i].equals("list") ) {
log( "Doing a list" );
String str = "<m:list xmlns:m=\"AdminService\"/>" ;
input = new ByteArrayInputStream( str.getBytes() );
} else if (args[i].equals("quit")) {
log("Doing a quit");
String str = "<m:quit xmlns:m=\"AdminService\"/>";
input = new ByteArrayInputStream(str.getBytes());
} else if (args[i].equals("passwd")) {
log("Changing admin password");
if (args[i + 1] == null) {
log("Must specify a password!");
return null;
}
String str = "<m:passwd xmlns:m=\"AdminService\">";
str += args[i + 1];
str += "</m:passwd>";
input = new ByteArrayInputStream(str.getBytes());
i++;
}
else {
log( "Processing file: " + args[i] );
input = new FileInputStream( args[i] );
}
ServiceClient client = new ServiceClient(opts.getURL());
/** Unfortunately, this is transport-specific. However, no one
* but the HTTP transport should pick this property up.
*/
client.set(HTTPConstants.MC_HTTP_SOAPACTION, "AdminService");
Message inMsg = new Message( input, true );
client.setRequestMessage( inMsg );
client.set( Transport.USER, opts.getUser() );
client.set( Transport.PASSWORD, opts.getPassword() );
String tName = opts.isValueSet( 't' );
if ( tName != null && !tName.equals("") )
client.setTransportName( tName );
client.invoke();