Not every operation you will want to declare will be satisfied by one return value or immutable parameters. The declarators
- in,
- out, and
- inout
refer to how the parameter is copied over the wire. Parameters marked as in are copied and reconstructed on the server.
Parameters marked as out work just like return values, in that there is no information copied from the client, but a brand new object is copied from the server and reconstructed on the client.
Parameters marked as
out
work just like return values, in that there is no information copied from the client, but a brand new object is copied from the server and reconstructed on the client.
Parameters marked
inout
are just like having one
in
parameter and one
out
parameter. The
in
side parameter is copied and reconstructed on the server side.
The server can do whatever it wants with the local copy or create a new one. It then sends the
out
side of the parameter back when the method returns.
On the client side, a wholly new object is created, just like a return value, and the reference is replaced as the stub method returns.
In C++ or Pascal, where pass by reference or VAR parameters are allowed, the idea that the parameter reference is replaced with a new object reference or pointer is obvious.
In Java, it requires a little work. The IDL-to-Java mapping creates, for each new class generated, a
reference class so that objects can be passed by reference.