CodingAdai commented on issue #2165:
URL: https://github.com/apache/dubbo-go/issues/2165#issuecomment-1383449600

   > 
场景:服务端是java实现的dubbo服务;调用方是dubbo-go泛化调用。服务端返回的结构体是{"isSuccess":true},但是dubbo-go收到的却是{"success":true}
   > 
   > 请问如何接收到原始的isSuccess字段呢
   
   @LvBay   
   
这个跟Dubbo实现泛型调用机制有关,SDK中的GenericFilter会拦截调用来实现泛型调用,在返回结果时会装换成map结构并序列化,其中map的字段名通过反射获取getter来获取(getXXX/isXXX
 取XXX首字母小写)。
    
   可以检查下Java提供者服务的接口返回值 中的 isSuccess 
的getter方法名,如果为isSuccess(),则修改为getIsSuccess(),Go client中可以获取到isSuccess字段名。
   
   
注:[GenericFilter.java中转换并返回结果的具体代码](https://github.com/apache/dubbo/blob/cc6e1aea8949206be571ccc8d7719702679a4c72/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java#L269)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to