public static void main(String args[]) throws Exception {
URL wsdlUrl = Client.class.getResource("/wsdl/bank.wsdl");
BankCORBAService ss = new BankCORBAService(wsdlUrl, SERVICE_NAME);
Bank port = ss.getBankCORBAPort();
System.out.print("Invoking createAccount for Mr. John... ");
javax.xml.ws.Holder<Account> account = new javax.xml.ws.Holder<Account>(new Account());
try {
if (port.createAccount("John", account)) {
System.out.println("success");
} else {
System.out.println("failure (Unknown)");
}
} catch (AccountAlreadyExistsException ex) {
System.out.println("failure (" + ex.getMessage() + " : " + ex.getFaultInfo().getName() + ")");
}
Account bankAccount = account.value;
if (bankAccount != null) {
System.out.println("Created Account : "
+ bankAccount.getName() + ": " + bankAccount.getBalance());
}
System.out.println("Getting Mr. John's account...");
try {
bankAccount = port.getAccount("John");
if (bankAccount != null) {
System.out.println("success");
System.out.println(bankAccount.getName() + ": " + bankAccount.getBalance());
} else {
System.out.println("failure");
}
} catch (AccountNotFoundException ex) {
System.out.println("failure (" + ex.getMessage() + " : " + ex.getFaultInfo().getName() + ")");
}
System.out.println("Getting an non-existent account (Ms. Helen)...");
try {
bankAccount = port.getAccount("Helen");
} catch (AccountNotFoundException ex) {
System.out.println("Caught the expected AccountNotFoundException("
+ ex.getFaultInfo().getName() + ")");
}