Pre-check

  • [x] I am sure that all the content I provide is in English.

Search before asking

  • [x] I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

Dubble 3.3.4, java 17

Steps to reproduce this issue

Try to access triple with http post method and found errors. Just run the example with idl support and then run the curl command on linux to test and It doesnot work for idl. and on windows postman can be used.

curl --header "Content-Type: application/json" --data '{"name":"Dubbo"}' http://192.168.71.37:50051/org.apache.dubbo.sample.proto.Simple/streamHello

It means that with idl support, the server streaming give errors

org.apache.dubbo.remoting.http12.exception.HttpStatusException: Invoker not found at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.doRoute(AbstractServerTransportListener.java:124) ~[dubbo-3.3.4.jar:3.3.4] at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.onBeforeMetadata(AbstractServerTransportListener.java:118) ~[dubbo-3.3.4.jar:3.3.4]

dubbo.zip

What you expected to happen

Dubbo with idl support should have the same behaviour as that has no idl support which supports both unary and server streaming.

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • [ ] Yes I am willing to submit a pull request on my own!

Code of Conduct

Comment From: oxsean

Thanks for report, it's a bug. https://github.com/apache/dubbo/blob/da8fd19c2c041326f9d35c47b2448e37b35ca716/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/DefaultRequestMappingRegistry.java#L132 The StreamObserver type parameter needs to be ignored.

Comment From: fantiq

Thanks for report, it's a bug.

dubbo/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/DefaultRequestMappingRegistry.java

Line 132 in da8fd19

MethodDescriptor md = sd.getMethod(method.getName(), method.getParameterTypes());

The StreamObserver type parameter needs to be ignored.

@oxsean i have fix it. if RpcType is not UNARY, the paramTypes should ignore StreamObserver type. Can I submit a PR?

Comment From: oxsean

Thanks for report, it's a bug. dubbo/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/DefaultRequestMappingRegistry.java Line 132 in da8fd19 MethodDescriptor md = sd.getMethod(method.getName(), method.getParameterTypes()); The StreamObserver type parameter needs to be ignored.

@oxsean i have fix it. if RpcType is not UNARY, the paramTypes should ignore StreamObserver type. Can I submit a PR?

Sure, thanks.

Comment From: bryanxtong

With attachement below, and I also find another problem which I am not sure. when in proto files, package is provided, It is working to access org.apache.dubbo.sample.proto.Simple/sayHello via http post. but if we donot have this line(eg. package org.apache.dubbo.sample.proto;) I found neither way will work.

curl --header "Content-Type: application/json" --data '{"name":"Dubbo"}' org.apache.dubbo.sample.proto.Simple/sayHello {"message":"Invoker not found","status":"404"} curl --header "Content-Type: application/json" --data '{"name":"Dubbo"}' Simple/sayHello

dubbo-provider_no_proto_package.zip

`syntax = "proto3";

option java_multiple_files = true; option java_package = "org.apache.dubbo.sample.proto"; ### //package org.apache.dubbo.sample.proto; option java_outer_classname = "HelloWorldProto";

...

Please correct me if this is not a problem.

Comment From: fantiq

With attachement below, and I also find another problem which I am not sure. when in proto files, package is provided, It is working to access org.apache.dubbo.sample.proto.Simple/sayHello via http post. but if we donot have this line(eg. package org.apache.dubbo.sample.proto;) I found neither way will work.

curl --header "Content-Type: application/json" --data '{"name":"Dubbo"}' org.apache.dubbo.sample.proto.Simple/sayHello {"message":"Invoker not found","status":"404"} curl --header "Content-Type: application/json" --data '{"name":"Dubbo"}' Simple/sayHello {"message":"Invoker not found","status":"404"}

dubbo-provider_no_proto_package.zip

`syntax = "proto3";

option java_multiple_files = true; option java_package = "org.apache.dubbo.sample.proto"; ### //package org.apache.dubbo.sample.proto; option java_outer_classname = "HelloWorldProto";

...

Please correct me if this is not a problem.

It depends on your implementation method.

if the service class extends *ImplBase, the corresponding relationship between rest path and proto package is as follows:

Assume that there is the following proto file

option java_package = "foo.bar";
service GreeterService {
    rpc run(xx) returns (xx);
}
package http path
package pkg; /pkg.GreeterService/foo.bar.GreeterService/run
package foo.bar; /foo.bar.GreeterService/run
N/A /GreeterService/foo.bar.GreeterService/run

if the service class implements interface, the http path is interface name, there is /foo.bar.GreeterService/run.

Comment From: bryanxtong

Ok, Thanks. It seems that the first one and second(if the java package and package the same, ignore "/foo.bar.GreeterService" once) doesnot obey the same rule which make me puzzled.

It can be closed now.