You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/04/16 06:21:01 UTC

[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1712: 客户端调用,服务提供者方法参数为对象嵌套的情况下,无法反序列化出来参数的实际对象

liubao68 commented on issue #1712: 客户端调用,服务提供者方法参数为对象嵌套的情况下,无法反序列化出来参数的实际对象
URL: https://github.com/apache/servicecomb-java-chassis/issues/1712#issuecomment-614439190
 
 
   是通过透明RPC(POJO)模式定义的服务接口吗? 这种情况,客户端的视角看到的swagger参数,就是一个。 说明参考: http://localhost:8000/featured-topics/features/weak-type-contrast/
   
   `getSwaggerArguments 始终获取的是和契约对应的参数,如果契约为 x 和 y 两个 query 参数, 那么得到的参数就是 包含 x 和 y 的 Map 。 getInvocationArgument 获取的是实际类型参数, 在服务提供者,这个参数列表的个数和类型 和实际的 Method 的列表对应, 比如可能包含 InvocationContext , HttpServletRequest 等注入参数。 还有很多情况, 契约参数和类型参数不对应,比如聚合参数的情况,契约参数是多个 query 参数, 而类型参数是一个 POJO; 再比如 POJO 接口 定义的时候, 类型参数可能是多个, 而契约参数只有一个 body 参数。 在服务消费者,如果用户采用 POJO 方式调用服务提供者, 两个接口的返回的值与服务提供者类似,存在语义差别;如果采用 RestTemplate 或者 InvokerUtils 调用, 那么两个接口返回的 内容一样,都是契约参数。在边缘服务, 两个接口返回的都是契约参数。 这种行为体现了弱类型契约的语义: 是否存在编译时 类型与契约对应。`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services