==== 8.5.2 processCommand Method ==== The **processCommand** method of the **RMIService** class is invoked by the applet to process an incoming RMI message. **RMIService** collaborates with other services by using the common service format (CSF) in the APDU buffer. It processes only the incoming Java Card RMI APDU commands and produces output as described in the previous sections. When called with a SELECT FILE command with format described in [[8.4.1_SELECT FILE Command| Section 8.4.1, SELECT FILE Command]], this method builds a response APDU as described in that section. When called with an INVOKE command with the format described in [[8.4.2_INVOKE Command| Section 8.4.2, INVOKE Command]], this method must call the specified remote method of the identified remote object with the specified parameters. It must catch all exceptions thrown by the remote method. When an exception is caught or the remote method returns, this method must build a response APDU in the format described in [[8.4.2_INVOKE Command| Section 8.4.2, INVOKE Command]]. Prior to invoking the remote method, the following errors must be detected and must result in an error response in the format described in [[8.3.5.3_Error Response Encoding| Section 8.3.5.3, Error Response Encoding]]: *The remote object identifier is not valid. *The remote object identifier was not returned during the current selection session. *The method identifier does not match any remote methods in the remote class associated with the identified remote object. *The length of the INVOKE message is inconsistent with the signature of the remote method. *There is insufficient space to allocate array parameters for the remote method. The implementation must support at least eight input parameters of type array. In addition, upon return from the remote method, the following errors must be detected and must result in an error response in the format described in [[8.3.5.3_Error Response Encoding| Section 8.3.5.3, Error Response Encoding]]: *There is insufficient space to allocate the array response from the remote method. The implementation must support an APDU buffer of at least 133 bytes. *A remote object is being returned, and its associated remote object identifier was not previously returned during the current selection session, and there is insufficient space to add the remote object identifier to the session remote object identifier list. The implementation must support at least eight remote object identifiers during a selection session. In addition, the object access firewall rules must be enforced in a manner similar to that of the **invokevirtual** instruction ([[6.2.8.4_Accessing Class Instance Object Methods| Section 6.2.8.4, Accessing Class Instance Object Methods]]) by this method when a remote method is invoked. Only methods of a remote object owned by the context of the currently selected applet may be invoked. == Allocation of Incoming Objects == Because array parameters to remote methods are transmitted by value, array objects need to be allocated on the card when a remote method with array arguments is invoked via the INVOKE command. Global array objects ([[6.2.2_Global Arrays| Section 6.2.2, Global Arrays]]) must be used for incoming remote method arguments. Global arrays have the following properties: *They are owned by the Java Card RE, but they can be freely accessed from all contexts. *They are temporary objects and cannot be stored in any object. *They are not subject to transactions. The implementation may choose to maintain the data portion of these global array objects used for remote method parameters in the APDU buffer itself. Copyright © 2005, Sun Microsystems, Inc. All Rights Reserved.