dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Bug] The triple protocol is called through http, and the return value is incorrect

Open crazyStar00 opened this issue 1 year ago • 9 comments

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

dubbo version:3.3.0-beta.1 jdk:1.8 platform:windows 10

Steps to reproduce this issue

Start the service using the TriPojoServer class of the dubco-samples-triple-no-IDl module and invoke the service using http image

What you expected to happen

I understand that you should return “hello star“,but return "hello,{"request":"star"}"

Anything else

No response

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

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

Code of Conduct

crazyStar00 avatar Apr 02 '24 06:04 crazyStar00

This is a misunderstanding caused by habitual thinking, perhaps because you're accustomed to data being passed in JSON format. 2024-04-02_22 08 27 2024-04-02_22 09 52

The PojoGreeter interface definition explicitly specifies the parameter type as String. Therefore, the method receives a string as data. In the implementation class PojoGreeterImpl, the received parameter is simply concatenated. Hence, the response you obtained is completely correct.

Below is the result obtained by calling the operation using the TriPojoClient from the provided sample, and the response matches yours exactly.

2024-04-02_22 11 06 2024-04-02_22 11 45

cnzakii avatar Apr 02 '24 14:04 cnzakii

This is a misunderstanding caused by habitual thinking, perhaps because you're accustomed to data being passed in JSON format. 2024-04-02_22 08 27 2024-04-02_22 09 52

The PojoGreeter interface definition explicitly specifies the parameter type as String. Therefore, the method receives a string as data. In the implementation class PojoGreeterImpl, the received parameter is simply concatenated. Hence, the response you obtained is completely correct.

Below is the result obtained by calling the operation using the TriPojoClient from the provided sample, and the response matches yours exactly.

2024-04-02_22 11 06 2024-04-02_22 11 45

How should a single string parameter be passed in an http request?

crazyStar00 avatar Apr 09 '24 06:04 crazyStar00

This is a peculiar issue. If you've configured the Triple protocol, you should be using it for communication instead of using another protocol like HTTP.

cnzakii avatar Apr 09 '24 15:04 cnzakii

This is a peculiar issue. If you've configured the Triple protocol, you should be using it for communication instead of using another protocol like HTTP.

http call also uses the triple protocol ;dubbo version : 3.3.0-beta.2

crazyStar00 avatar Apr 10 '24 00:04 crazyStar00

This is a misunderstanding caused by habitual thinking, perhaps because you're accustomed to data being passed in JSON format. 2024-04-02_22 08 27 2024-04-02_22 09 52 The PojoGreeter interface definition explicitly specifies the parameter type as String. Therefore, the method receives a string as data. In the implementation class PojoGreeterImpl, the received parameter is simply concatenated. Hence, the response you obtained is completely correct. Below is the result obtained by calling the operation using the TriPojoClient from the provided sample, and the response matches yours exactly. 2024-04-02_22 11 06 2024-04-02_22 11 45

How should a single string parameter be passed in an http request?

For single-parameter services, the application/json mode cannot be used. You can use text/plain, application/x-www-form-urlencoded, or application/x-www-form-urlencoded

crazyStar00 avatar Apr 12 '24 03:04 crazyStar00

This is a misunderstanding caused by habitual thinking, perhaps because you're accustomed to data being passed in JSON format. 2024-04-02_22 08 27 2024-04-02_22 09 52 The PojoGreeter interface definition explicitly specifies the parameter type as String. Therefore, the method receives a string as data. In the implementation class PojoGreeterImpl, the received parameter is simply concatenated. Hence, the response you obtained is completely correct. Below is the result obtained by calling the operation using the TriPojoClient from the provided sample, and the response matches yours exactly. 2024-04-02_22 11 06 2024-04-02_22 11 45

How should a single string parameter be passed in an http request?

For single-parameter services, the application/json mode cannot be used. You can use text/plain, application/x-www-form-urlencoded, or application/x-www-form-urlencoded

just dubbo version: 3.3.0-beta.2+

crazyStar00 avatar Apr 12 '24 03:04 crazyStar00

This is a misunderstanding caused by habitual thinking, perhaps because you're accustomed to data being passed in JSON format. 2024-04-02_22 08 27 2024-04-02_22 09 52 The PojoGreeter interface definition explicitly specifies the parameter type as String. Therefore, the method receives a string as data. In the implementation class PojoGreeterImpl, the received parameter is simply concatenated. Hence, the response you obtained is completely correct. Below is the result obtained by calling the operation using the TriPojoClient from the provided sample, and the response matches yours exactly. 2024-04-02_22 11 06 2024-04-02_22 11 45

How should a single string parameter be passed in an http request?

For single-parameter services, the application/json mode cannot be used. You can use text/plain, application/x-www-form-urlencoded, or application/x-www-form-urlencoded

just dubbo version: 3.3.0-beta.2+ dubbo version 3.3.0-beta.1 http body head only support :application/json and application/grpc+proto

crazyStar00 avatar Apr 12 '24 03:04 crazyStar00

@oxsean PTAL

AlbumenJ avatar May 06 '24 06:05 AlbumenJ

This is a misunderstanding caused by habitual thinking, perhaps because you're accustomed to data being passed in JSON format. 2024-04-02_22 08 27 2024-04-02_22 09 52 The PojoGreeter interface definition explicitly specifies the parameter type as String. Therefore, the method receives a string as data. In the implementation class PojoGreeterImpl, the received parameter is simply concatenated. Hence, the response you obtained is completely correct. Below is the result obtained by calling the operation using the TriPojoClient from the provided sample, and the response matches yours exactly. 2024-04-02_22 11 06 2024-04-02_22 11 45

How should a single string parameter be passed in an http request?

For single-parameter services, the application/json mode cannot be used. You can use text/plain, application/x-www-form-urlencoded, or application/x-www-form-urlencoded

dubbo's parameter bind not the same as spring mvc, i think this is not a problem.

laywin avatar May 14 '24 03:05 laywin

The json body process first tries to take the body and decode it to the target type, and if it matches, it doesn't try to decode the json.

oxsean avatar Sep 09 '24 06:09 oxsean