in 3-extensions/serialization/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/main/java/org/apache/dubbo/sample/protobuf/genericCall/GenericClient.java [38:58]
public static void main(String[] args) throws Exception {
ReferenceConfig<GenericService> reference = new ReferenceConfig<>();
ApplicationConfig applicationConfig = new ApplicationConfig("protobuf-demo-consumer");
applicationConfig.setQosEnable(false);
reference.setApplication(applicationConfig);
reference.setInterface("org.apache.dubbo.sample.protobuf.GoogleProtobufService");
reference.setGeneric(CommonConstants.GENERIC_SERIALIZATION_PROTOBUF);
reference.setRegistry(new RegistryConfig("zookeeper://" + zookeeperHost + ":2181"));
GenericService genericService = reference.get();
printServiceData();
Map<String, Object> request = new HashMap<>();
request.put("string", "message from client");
String requestString = new Gson().toJson(request);
Object result = genericService.$invoke("callGoogleProtobuf", new String[]{
"org.apache.dubbo.sample.protobuf.GoogleProtobufBasic$GooglePBRequestType"},
new Object[]{requestString});
System.out.println(new Gson().toJson(result));
}