Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GO and JAVA cannot communicate with each other due to case issues #2569

Closed
ssfyn opened this issue Jan 9, 2024 · 5 comments
Closed

GO and JAVA cannot communicate with each other due to case issues #2569

ssfyn opened this issue Jan 9, 2024 · 5 comments

Comments

@ssfyn
Copy link

ssfyn commented Jan 9, 2024

Environment

  • Server: go: v3.1.0 or v3.1.1-rc1, java: 3.17
  • Client: go: v3.1.0 or v3.1.1-rc1, java: 3.17
  • Protocol: triple
  • Registry: zookeeper (go: interface, java: service+interface)

Issue description

Should the rpc method in the proto file be defined as PascalCase or camelCase?
No matter which one, go and java are currently unable to communicate with each other.

rpc method using PascalCase:

// The greeting service definition.
service GreeterService {
  // Sends a greeting
  rpc Greet(HelloRequest) returns (HelloResponse) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloResponse {
  string message = 1;
}
result: java client convert method name to camelCase
client server result
go go Success
go java Success
java java java client: throw exception UNIMPLEMENTED : Method : greet not found of service:com.example.triple.service.GreeterService, maybe because java server return status is UNIMPLEMENTED(12)
java go go server: return error cannot find method [greet] of service [com.example.GreeterService] in dubbo

rpc method using camelCase (not followed protobuf style guid):

// The greeting service definition.
service GreeterService {
  // Sends a greeting
  rpc greet(HelloRequest) returns (HelloResponse) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloResponse {
  string message = 1;
}
result: go server convert method name to PascalCase, but serviceInfo still camelCase
client server result
go go go server: throw error: unknown method Greet for service com.example.GreeterService
go java Success
java java Success
java go go server: throw error: unknown method Greet for service com.example.GreeterService
@FoghostCn
Copy link
Contributor

FoghostCn commented Jan 9, 2024

PascalCase should be used, in java side PascalCase and camelCase always generate camelCase method name , but in go side currently method name is same with proto defined name

update: go 3.1.x is always PascalCase,3.2 will be PascalCase also #2570

@ssfyn
Copy link
Author

ssfyn commented Jan 9, 2024

PascalCase should be used, in java side PascalCase and camelCase always generate camelCase method name , but in go side currently method name is same with proto defined name

If you use PascalCase, an error will occur when java calls java or go services through the triple protocol.
Maybe it's because the java client converts the method name to camelCase during the transmission process.

java server return: UNIMPLEMENTED : Method : greet not found of service:com.example.triple.service.GreeterService
go server return: cannot find method [greet] of service [com.example.GreeterService] in dubbo

@FoghostCn
Copy link
Contributor

FoghostCn commented Jan 9, 2024

please create a demo project to reproduce, java client call java server is a basic usage,I'm confused how it happen

@ssfyn
Copy link
Author

ssfyn commented Jan 11, 2024

please create a demo project to reproduce, java client call java server is a basic usage,I'm confused how it happen

see this example

Is spring proxy problem, the @DubboReference default proxy use java service reflect assemble url.
When I add proxy = CommonConstants.NATIVE_STUB parameter, I can call it.
It is recommended to add some explanation in the examples or documentation.

@FoghostCn
Copy link
Contributor

FoghostCn commented Jan 12, 2024

I still can't reproduce you problem, but if you think the proxy parameter not work as you expect you can open an issue in the dubbo java project

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants