Before we start
Before getting started, make sure you have a running gRPC service. If the gRPC service does not have Reflection Service enabled, make sure you have the proto
file that contains the service definition
For this tutorial we’ll be using the sample Northwind gRPC service. The code for this service can be found on github at https://github.com/namigop/FintX/tree/main/source/Tefin.Grpc.Sample . The proto file containing the service definitions is in the source/Protos
sub folder. Below is a snippet of the proto file showing the service and its 6 methods
service NorthwindService {
// GetOrderById retrieves a single order by its ID
rpc GetOrderById(OrderRequest) returns (Order) {}
// GetOrdersByCustomer streams all orders for a given customer
rpc GetOrdersByCustomer(CustomerRequest) returns (stream Order) {}
// GetCustomers retrieves all customers
rpc GetCustomers(CustomersRequest) returns (CustomersResponse) {}
// UpdateOrderStatus allows bidirectional streaming of order status updates
rpc UpdateOrderStatus(stream OrderStatusUpdate) returns (stream OrderStatusResponse) {}
// AddOrderDetails allows streaming multiple order details for batch processing
rpc AddOrderDetails(stream OrderDetail) returns (OrderDetailsResponse) {}
// SubmitOrder creates a new order with all its details
rpc SubmitOrder(SubmitOrderRequest) returns (SubmitOrderResponse) {}
}
Let’s start
Take the gRPC Northwind Service and start it. Once it’s up follow the steps below
Create a gRPC client
Run FintX.exe and then click on the Add Client
button to bring up the dialog below.
- Select Reflection Service (or proto file)
- If you selected Reflection Server, enter the URL of the gRPC service
- If the URL is hosting multiple gRPC services, select the one that you would like to test
- Enter a name for this client
- Optionally, add a description.
- Now click the Okay button. FintX will generate code for the gRPC client and compile it. Once it’s completed, it will show the generated gRPC methods
Invoke a method
Once, the client is compiled and displayed in the UI, you can double-click
on any method (or click the Open In New Tab
button, which shows up after selecting the method )
- Select a method
- Double click on any node in the object tree to edit its value
- Invoke the gRPC service!
Summary
Calling gRPC services with FintX is super easy. Just add a client, open the method, edit the request, and finally click the Send button to invoke the service!
[…] QuickStart Guide shows an example of calling gRPC Unay […]