As we learned in Section 28.11, for each operation on an interface, a proxy object narrowed to that type supports a corresponding method with the same name. To invoke an operation, you call it via the proxy. For example, here is part of the definitions for our file system from
Section 5.4:
The name operation returns a value of type
string. Given a proxy to an object of type
Node, the client can invoke the operation as follows:
You can add an idempotent qualifier to a Slice operation. As far as the signature for the corresponding proxy method is concerned,
idempotent has no effect.
A proxy object narrowed to the ClientToServer interface supports the following methods:
Given a proxy to a ClientToServer interface, the client code can pass parameters as in the following example:
Given a proxy to a ServerToClient interface, the client code can receive the results as in the following example:
Note that it is not necessary to use the reference operator (&) before each argument because the Ice run time forces each out parameter to have reference semantics.
Some Slice types naturally have “empty” or “not there” semantics. Specifically, sequences, dictionaries, and strings all can be
null, but the corresponding Slice types do not have the of a null value. To make life with these types easier, whenever you pass
null as a parameter or return value of type sequence, dictionary, or string, the Ice run time automatically sends an empty sequence, dictionary, or string to the receiver.
This behavior is useful as a convenience feature: especially for deeply-nested data types, members that are sequences, dictionaries, or strings automatically arrive as an empty value at the receiving end. This saves you having to explicitly initialize, for example, every string element in a large sequence before sending the sequence in order to avoid a run-time error. Note that using null parameters in this way does
not create null semantics for Slice sequences, dictionaries, or strings. As far as the object model is concerned, these do not exist (only
empty sequences, dictionaries, and strings do). For example, it makes no difference to the receiver whether you send a string as
null or as an empty string: either way, the receiver sees an empty string.