gRPC Protocol
The gRPC plugin discovers services from the host's compiled descriptors when embedded, via gRPC Server Reflection otherwise, and supports all four gRPC call types.
Package: Kuestenlogik.Bowire.Protocol.Grpc (included with Kuestenlogik.Bowire)
Setup
builder.Services.AddGrpc();
builder.Services.AddBowire();
var app = builder.Build();
app.MapGrpcService<GreeterService>();
app.MapBowire();
Embedded like this, Bowire reads the contract of every gRPC service the host maps from the descriptors protoc compiled into it. No reflection endpoint is mapped and none is needed. See Embedded hosts for the options.
Standalone, Bowire asks the target server for its contract through gRPC Server Reflection. A server with reflection switched off, which is the usual production setting, is called through an uploaded descriptor set instead: see Servers without reflection.
Discovery
The gRPC plugin queries the reflection service to enumerate:
- All registered gRPC services and their fully qualified names
- Each method with its call type (unary, server streaming, client streaming, duplex)
- Protobuf message schemas including field names, types, numbers, and nesting
- Enum definitions with their values
- HTTP transcoding annotations (
google.api.http) when the proto declares them — see below
Internal services (like grpc.reflection.v1alpha.ServerReflection) are hidden by default.
HTTP Transcoding Discovery
When a .proto file annotates RPC methods with google.api.http rules, Bowire reads those annotations directly from the reflection descriptors and surfaces the HTTP verb + path on the discovered method:
import "google/api/annotations.proto";
service TodoService {
rpc GetTodo (GetTodoRequest) returns (TodoItem) {
option (google.api.http) = {
get: "/v1/todos/{id}"
};
}
}
After discovery, GetTodo shows up in the Bowire sidebar with both the gRPC method type badge and an HTTP GET badge. The path template /v1/todos/{id} is captured in the same BowireMethodInfo.HttpPath field that the REST plugin uses, so the existing UI just renders it correctly without any special-casing.
This works regardless of whether the server actually implements HTTP transcoding (via Microsoft.AspNetCore.Grpc.JsonTranscoding) — Bowire only reads the annotation, the discovery doesn't depend on the transcoding endpoints being live. The annotation itself is part of the proto descriptor which gRPC reflection always returns.
Behind the scenes
The google.api.http rule is a proto custom option with field number 72295728 on MethodOptions. Without explicit setup, Google.Protobuf C# stores extension bytes in the message's unknown-field collection and GetExtension(...) returns null. Bowire's reflection client configures the descriptor parser with an ExtensionRegistry that knows about the typed extension:
private static readonly MessageParser<FileDescriptorProto> DescriptorParser =
FileDescriptorProto.Parser.WithExtensionRegistry(new ExtensionRegistry
{
AnnotationsExtensions.Http
});
The extension definition comes from the Google.Api.CommonProtos NuGet package, which Bowire pulls in for exactly this reason. With the parser configured, MethodDescriptorProto.Options.GetExtension(AnnotationsExtensions.Http) returns the typed HttpRule whenever the annotation is present.
Parallel HTTP invocation
Discovery alone gives you the verb badges in the sidebar, but Bowire goes one step further: when the REST plugin is also loaded, transcoded methods get a small gRPC | HTTP toggle in the action bar. The user picks how they want to invoke the same call, the choice is remembered per method.
[Execute] gRPC ◀▶ HTTP Method: GetBook
GET /v1/books/{id}
How it works:
- The gRPC plugin's reflection discovery detects the
google.api.httpannotation and writes the verb + path onto the existingBowireMethodInfo.HttpMethod/HttpPathfields - It also tags each input field with the right HTTP source bucket based on the path template:
- Field names that match a
{placeholder}in the path →Source = "path" - For GET / DELETE / HEAD / OPTIONS, remaining fields →
Source = "query" - For POST / PUT / PATCH, remaining fields →
Source = "body"
- Field names that match a
- When the user clicks "HTTP", the JS sends the inline transcoded method info with the invoke request
- The
/api/invokeendpoint resolves anIInlineHttpInvokerfrom the protocol registry — the REST plugin implements that interface and delegates to its existingRestInvoker - The HTTP request is built and sent the same way OpenAPI-discovered REST methods are invoked
Plugin boundary
Bowire keeps a clean plugin boundary here: core has zero HTTP-invocation code. The IInlineHttpInvoker interface lives in core, but every implementation lives in a protocol plugin. The dispatch path looks like:
graph LR
A["JS toggle: HTTP"] -->|inline method info| B["/api/invoke"]
B --> C{REST plugin loaded?}
C -->|yes| D["BowireRestProtocol.InvokeHttpAsync"]
D --> E["RestInvoker"]
E -->|HttpClient| F["Target server"]
C -->|no| G["501 'install REST plugin'"]
When the REST plugin isn't installed:
- Transcoded methods still discover correctly with verb + path
- The toggle is replaced by a read-only info badge showing
GET /v1/books/{id} - Clicking the badge shows a tooltip explaining how to enable HTTP invocation
- Users who only want gRPC don't pull in any HTTP invocation infrastructure
This means a minimal bowire plugin install Kuestenlogik.Bowire.Protocol.Grpc install gives you full gRPC + transcoding discovery, without dragging in Microsoft.OpenApi.Readers, RestInvoker, or any of the REST plugin's other internals. Add Kuestenlogik.Bowire.Protocol.Rest to enable the parallel HTTP invocation path.
Sample
Bowire.Samples/SimpleGrpcTranscoding/ is a LibraryService that exercises every common verb:
GET /v1/books/{id} GetBook
GET /v1/books ListBooks
POST /v1/books CreateBook (body: "*")
PUT /v1/books/{id} UpdateBook (body: "*")
PATCH /v1/books/{id} PatchBook (body: "*")
DELETE /v1/books/{id} DeleteBook
CountBooks (no annotation — gRPC only)
The sample uses Microsoft.AspNetCore.Grpc.JsonTranscoding server-side so the same method really is reachable both ways. Run it on port 5007 and Bowire at port 5080 with --url=https://localhost:5007.
Call Types
sequenceDiagram
participant C as Client
participant S as Server
Note over C,S: Unary
C->>S: Request
S->>C: Response
Note over C,S: Server Streaming
C->>S: Request
S-->>C: Response 1
S-->>C: Response 2
S-->>C: Response N
Note over C,S: Client Streaming
C-->>S: Message 1
C-->>S: Message 2
C-->>S: Message N
S->>C: Response
Note over C,S: Duplex
C-->>S: Message 1
S-->>C: Response 1
C-->>S: Message 2
S-->>C: Response 2
Unary
The most common pattern. Send one request, receive one response. Bowire auto-generates a JSON template from the protobuf schema.
Server Streaming
Send one request, receive a stream of responses. Messages appear in real-time in the response viewer via SSE. Click Stop to cancel.
Client Streaming
Queue multiple messages in the UI, then send them all at once. The server responds after all messages are received.
Duplex (Bidirectional)
Open an interactive channel to send and receive messages simultaneously. Both directions operate independently. See Duplex Channels.
Embedded hosts
An embedded Bowire shows the host's own gRPC services without Server Reflection. protoc-generated code carries a descriptor for each .proto, and the plugin reads it for every service mapped with MapGrpcService<T>(), whether that happens before or after MapBowire(). Discovery makes no network call to the host; calls go to the host as gRPC.
AddBowireGrpc covers what that cannot see:
builder.Services.AddBowireGrpc(grpc =>
{
// A contract whose generated code is in this process but whose
// service is not mapped here.
grpc.Descriptors.Add(WeatherReflection.Descriptor);
// A contract that lives in another process: a compiled descriptor set
// (protoc --descriptor_set_out=api.protoset --include_imports).
grpc.DescriptorSetFile = "contracts/api.protoset";
});
| Option | Default | Meaning |
|---|---|---|
Descriptors |
empty | FileDescriptors to show in addition to the mapped services. Their imports come along. |
DescriptorSet |
empty | A compiled FileDescriptorSet as bytes. |
DescriptorSetFile |
none | The same, read from a file. A relative path is resolved against the content root. A file that is missing or is not a descriptor set fails discovery with the path in the message. |
UseMappedServices |
true |
Read the descriptors of the gRPC services the host maps. Off: show only what the other options name. |
MapReflectionService |
false |
Also map the gRPC Server Reflection endpoints. |
A service without generated code (a code-first contract) has no descriptor to read. Name its descriptor set, or map reflection.
The reflection endpoints are opt-in
Up to 2.10, MapBowire() mapped grpc.reflection.v1 and grpc.reflection.v1alpha on every embedding host. Those endpoints hand the full contract to any client that can reach the port, and a host that classifies or audits its endpoints had two more to account for. MapBowire() no longer maps them.
Map them when clients outside the process (grpcurl, a standalone Bowire) should be able to ask this host. Either set the option or map the service yourself, not both: mapping it twice makes the route ambiguous and every reflection call fails.
builder.Services.AddBowireGrpc(grpc => grpc.MapReflectionService = true);
// or
app.MapGrpcReflectionService();
Servers without reflection
A server that does not answer reflection is called through a descriptor set: the server's .proto files, compiled.
protoc --descriptor_set_out=api.protoset --include_imports -I protos api.proto
Drop api.protoset on the schema drop zone (a workspace's Sources, or the sidebar). .pb, .desc and .binpb are taken as the same thing. The services it describes appear under the server's URL, and unary calls, streams and channels go through it with no further setting. On the command line, name the file with --schema api.protoset.
--include_importsis required. Without it the set lacks the files your.protoimports. Bowire refuses such a set at upload and names the missing file.- The set answers for the services it describes, and only those. It is stored for the workspace, not for one server. A call to a service it does not describe still asks its server by reflection, so a workspace can hold a server with reflection beside one without.
- For a service it describes, the set wins. Bowire does not ask the server first. If the set is older than the server, calls fail with marshalling errors until you upload the current one.
- Sets are stored per workspace, beside the other schema files, as the file you uploaded. Clearing the uploaded schemas removes them.
A descriptor set can also travel with one call instead of being stored: --grpc-descriptor-set api.protoset on the command line, or the grpcDescriptorSet query parameter on /api/services.
.proto files give names only
You can also drop a .proto file. Bowire reads the service and method names from it and lists them, which is enough to browse a contract. It is not enough to call one: Bowire does not compile .proto source, so it has no message layouts to marshal a request with. A method from a .proto is callable only if the server answers reflection. The workbench says so when you upload one and on each such method.
When a descriptor set and a .proto describe the same service, the descriptor set's entry is the one listed.
gRPC-Web transport
The same plugin can speak gRPC-Web instead of native HTTP/2 gRPC. Useful for services that only expose gRPC-Web behind an L7 proxy (Envoy, grpcwebproxy, browser-fronted backends behind ASP.NET's UseGrpcWeb()), or that publish both a native and a gRPC-Web endpoint on different ports — Rheinmetall's TacticalAPI is the canonical case (:4267 native, :4268 gRPC-Web).
Two equivalent opt-in paths, in priority order:
URL hint — prefix the server URL with
grpcweb@. Symmetric to the existinggrpc@hint:bowire --url grpcweb@http://tactical.example:4268Metadata header —
X-Bowire-Grpc-Transport: webon a per-call basis. Exposed asBowireGrpcProtocol.TransportMetadataKeyfor callers that build the metadata dict programmatically. Anything else (or absence) falls back to the default native HTTP/2 transport.
| Call type | Native (default) | gRPC-Web |
|---|---|---|
| Unary | ✓ | ✓ |
| Server streaming | ✓ | ✓ |
| Client streaming | ✓ | ✗ |
| Duplex (bidirectional) | ✓ | ✗ |
Known limitation: client-streaming + duplex over gRPC-Web
OpenChannelAsync returns null in web mode, and the JS layer hides the "open channel" affordance on grpcweb@ URLs. The reason is below the plugin: gRPC-Web rides HTTP/1.1, which doesn't carry trailers, and the only variant Bowire enables (GrpcWebMode.GrpcWebText) round-trips its frames as length-prefixed base64 inside the request / response bodies — workable for half-duplex but not for the long-lived, simultaneously-flowing streams a duplex call needs. Even the binary GrpcWebMode.GrpcWeb variant requires trailers for status reporting, so it can't fall back without an HTTP/2-upgrade or WebSocket layer that the spec doesn't standardise. Unary and server-streaming work cleanly through InvokeAsync / InvokeStreamAsync either way.
If you need client-streaming or duplex against a TacticalAPI-style server, point Bowire at the native HTTP/2 port (e.g. TacticalAPI's :4267) and leave the default transport on. The transport choice is per call, so the same workbench session can mix both.
How the URL hint resolves
grpcweb@<url> is handled by BowireEndpointHelpers.ResolveHint, which expands it to ("grpc", X-Bowire-Grpc-Transport=web) and dispatches into this plugin. Discovery — which has no metadata bag on the public IBowireProtocol.DiscoverAsync interface — piggy-backs the choice on a __bowireGrpcTransport=web query-string marker that GrpcChannelBuilder.ExtractTransportFromUrl(...) strips before opening the channel. The end server never sees the marker; downstream services don't see the X-Bowire-Grpc-Transport header either, because GrpcChannelBuilder.StripTransportMarker(...) removes it from the forwarded metadata.
mTLS composes with web mode
When both an mTLS marker and the gRPC-Web hint are present, MtlsHandlerOwner's SocketsHttpHandler becomes the inner of the GrpcWebHandler — TLS at the bottom, gRPC-Web framing on top. The cert-trust opt-in (Bowire:TrustLocalhostCert) covers both transports.
Metadata
gRPC metadata (headers) can be added to any call via the Headers panel. Common uses:
authorization: Bearer <token>-- authenticationx-request-id: <uuid>-- request tracinggrpc-timeout: 30S-- call deadlineX-Bowire-Grpc-Transport: web-- opt into gRPC-Web for this call (see gRPC-Web transport)
Standalone Mode
The gRPC plugin works in both embedded and standalone modes. In standalone mode, point Bowire at any remote gRPC server:
bowire --url https://my-grpc-server:443
See also: Quick Start, Streaming