# Interface RpcChannel (3.19.4)

    public interface RpcChannel

Abstract interface for an RPC channel. An `RpcChannel` represents a communication line to a
[Service](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Service) which can be used to call that [Service](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Service)'s methods. The [Service](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Service) may
be running on another machine. Normally, you should not call an `RpcChannel` directly, but
instead construct a stub [Service](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Service) wrapping it. Example:

RpcChannel channel = rpcImpl.newChannel("remotehost.example.com:1234");
RpcController controller = rpcImpl.newController();
MyService service = MyService.newStub(channel);
service.myMethod(controller, request, callback);

Starting with version 2.3.0, RPC implementations should not try to build on this, but should
instead provide code generator plugins which generate code specific to the particular RPC
implementation. This way the generated code can be more appropriate for the implementation in use
and can avoid unnecessary layers of indirection.

## Methods

### callMethod(Descriptors.MethodDescriptor method, RpcController controller, Message request, Message responsePrototype, RpcCallback\<Message\> done)

    public abstract void callMethod(Descriptors.MethodDescriptor method, RpcController controller, Message request, Message responsePrototype, RpcCallback<Message> done)

Call the given method of the remote service. This method is similar to `
Service.callMethod()` with one important difference: the caller decides the types of the `
Message` objects, not the callee. The request may be of any type as long as `
request.getDescriptor() `

## ` method.getInputType()`

. The response passed to the callback will be of the same type as `responsePrototype` (which must have `getDescriptor()
method.getOutputType()`).

<br />

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `method` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.MethodDescriptor` |
| `controller` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.RpcController` |
| `request` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Message` |
| `responsePrototype` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Message` |
| `done` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.RpcCallback<https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Message>` |