Using Remote Objects in Remote Method Invocations

The client can now invoke remote methods on the initial reference object. The remote methods are declared in the Purse interface. The following code shows the client invoking the debit method.

Note:

A UserException exception thrown by the remote method is caught by the client code in normal Java programming language style.

    // debit the requested amount
    try {
        short balance = myPurse.debit ( debitAmount );
    }catch ( UserException jce ) {
        short reasonCode = jce.getReason();
        // process on card exception reason information
    }