use*_*447 5 protocol-buffers grpc proto3 grpc-java
根据以下页面,我应该能够 在“JSON 映射”下发送 json 有效负载:https : //developers.google.com/protocol-buffers/docs/proto3。
我想将 json 负载作为消息的一部分发送,我有以下 .proto 文件:
message EventsRequest{
message RequestElement {
struct payload = 1;
}
string customerId = 1;
repeated RequestElement jsonPayload = 2;
}
message EventsResponse {
int32 status = 1;
string rawResponseData = 2;
struct responseData = 3;
}
Run Code Online (Sandbox Code Playgroud)
但是编译它给了我以下错误:
[INFO] Compiling 1 proto file(s) to C:\workspace\...\target\generated-sources\protobuf\java
[ERROR] PROTOC FAILED: msg_service.proto:21:9: "struct" is not defined.
msg_service.proto:34:5: "struct" is not defined.
[ERROR] C:\workspace\...\src\main\proto\msg_service.proto [0:0]: msg_service.proto:21:9: "struct" is not defined.
msg_service.proto:34:5: "struct" is not defined.
Run Code Online (Sandbox Code Playgroud)
我也试过“结构”,但我遇到了同样的错误。
我误解了用法吗?如果我必须发送 json 有效负载,我是否以字符串形式传入?
谢谢
| 归档时间: |
|
| 查看次数: |
4524 次 |
| 最近记录: |