Services
Services are used to describe client-server protocols, for example network protocols. Client and server can exchange messages of two types: remote procedure casts and remote procedure calls.
Casts are fire and forget: there’s no result or confirmation returned. Calls may return results and/or throw exceptions.
Syntax
service ServiceName
{
c->s ClientToServerCast(ArgumentType argumentName, ...);
c->s ClientToServerCall(ArgumentType argumentName, ...) returns (ResultType resultName, ...) throws Exception1, Exception2, ...;
s->c ServerToClientCast(ArgumentType argumentName, ...);
s->c ServerToClientCall(ArgumentType argumentName, ...) returns (ResultType resultName, ...) throws Exception1, Exception2, ...;
}
where
ServiceNameis the service name identifierClientToServerCastetc. is the name of the function/messageArgumentTypeandargumentNameare type and name of function argumentsResultTypeandresultNameare type and name of return argumentsExceptionXare exception type names that can be thrown
Both return and throws are optional. If none of them is present, the function is a cast, otherwise it is a call.
There can be an arbitrary number of request and return arguments (comma-separated).
c->s and s->c tokens denote client-to-server and server-to-client messages.