When interoperating with dubbo-java, there may be an issue when client from java side try to invoke an rpc function whose first-letter is in lower case, since dubbo-go now only provide handler whose method name is always with upper-cased first letter, due to the language feature of golang. It would cause failure in rpc function invocation, as mentioned in https://github.com/apache/dubbo-go-samples/pull/771 .
To tackle this problem, a straightforward idea is to register another handler with a different first-letter case, and that's the change made by this pull request.
2. content-type codec mismatch
When using hessian2 for serialization, some version of java-side client would set a wrong content-type in request, causing marshal and unmarshal error. In order to tackle the problem, a backupCodec is introduced to handle the message in the server-side serialization type.
Validity of the solution
solution for problem 1
After adding a breakpoint at dubbo-go/server/server.go at line 254, which is the section that exports service , we can see the registered handlers on service->serviceOpts->rpsService->s->triServer->handlers, and /org.apache.dubbo.tri.hessian2.api.GreetingsService/greet is made possible by changes in this PR.
solution for problem 2
A warn message would be logged when request content-type and server serialization mismatches, and the server would try to marshal/unmarshal message in server serialization codec.
What's the purpose of the change
1. handler mismatch
When interoperating with dubbo-java, there may be an issue when client from java side try to invoke an rpc function whose first-letter is in lower case, since dubbo-go now only provide handler whose method name is always with upper-cased first letter, due to the language feature of golang. It would cause failure in rpc function invocation, as mentioned in https://github.com/apache/dubbo-go-samples/pull/771 .
To tackle this problem, a straightforward idea is to register another handler with a different first-letter case, and that's the change made by this pull request.
2. content-type codec mismatch
When using hessian2 for serialization, some version of java-side client would set a wrong content-type in request, causing marshal and unmarshal error. In order to tackle the problem, a backupCodec is introduced to handle the message in the server-side serialization type.
Validity of the solution
solution for problem 1
After adding a breakpoint at![image](https://github.com/apache/dubbo-go/assets/111160781/fd49b049-04cc-4d43-b6aa-c4b911d604d8)
dubbo-go/server/server.go
at line 254, which is the section that exports service , we can see the registered handlers onservice->serviceOpts->rpsService->s->triServer->handlers
, and/org.apache.dubbo.tri.hessian2.api.GreetingsService/greet
is made possible by changes in this PR.solution for problem 2
A warn message would be logged when request content-type and server serialization mismatches, and the server would try to marshal/unmarshal message in server serialization codec.![image](https://github.com/apache/dubbo-go/assets/111160781/761cbb64-0586-4749-bdcd-29cc8c483f71)