zhushengjun-it opened a new issue #292:
URL: https://github.com/apache/dubbo-go-hessian2/issues/292


   <!-- Please use this template while reporting a bug and provide as much info 
as possible. Not doing so may result in your bug not being addressed in a 
timely manner. Thanks!
   
   -->
   
   
   **What happened**:
   go-mod:
          go 1.15
   
         require (
            dubbo.apache.org/dubbo-go/v3 
v3.0.0-rc4-1.0.20211116041552-b90089d8b8a3
            github.com/apache/dubbo-go-hessian2 v1.9.3
        )
    
   **What you expected to happen**:
        go client调用javaserver时,javaserver获取到的接口的入参为空的情况。
   **How to reproduce it (as minimally and precisely as possible)**:
   server:
          
            public class BaseTestRpcBO implements Serializable {
   
                    private LigoLastMsgInfo ligoLastMsgInfo;
   
                    private long testId;
   
                    private String testContent;
   
                    private Map<String, String> testMap;
   
                    protected Set<String> testSet = new LinkedHashSet<>();
   
                    private Date testDateTime;
   
                    }
   
                    public class LigoLastMsgInfo implements Serializable {
   
                        private static final long serialVersionUID = 
-1295732691903413324L;
   
                        private long messageId;
   
                        private String text;
   
                        private Date messageTime;
                    }
   
   
   
   
   
   
   
   go client:
   
        func main() {
        err := config.Load()
        if err != nil {
                fmt.Println(fmt.Sprintf("err:%v", err))
                logger.Errorf("init load config error:%v", err)
                os.Exit(-1)
        }
        time.Sleep(3e9)
        textMessage := text.BaseTestRpcBO{}
        textMessage.LigoLastMsg = new(text.LigoLastMsgInfo)
        textMessage.LigoLastMsg.Text = "123123123"
        textMessage.LigoLastMsg.MessageId = 23213
        t := time.Now()
        textMessage.ExtendContent = "123321"
        textMessage.TestDateTime = &t
        resp, errGet := model.TxtProvider.TestRpcApiV2(context.Background(), 
"vgroup test content", 11223344, textMessage)
        if errGet != nil {
                logger.Errorf("response error:%v", errGet)
        }
        logger.Infof("resp:%v", resp)
   }
   go model:
   
   
       func InitTestRpcBo() {
          // ------for hessian2------
          hessian.RegisterPOJO(&BaseTestRpcBO{})
          hessian.RegisterPOJO(&TestRpcBO{})
          hessian.RegisterPOJO(&SecondTestRpcBO{})
          hessian.RegisterPOJO(&LigoLastMsgInfo{})
       }
   
      
       type BaseTestRpcBO struct {
          LigoLastMsg   *LigoLastMsgInfo
          TextMap       map[string]string
          TextSet       []string
          ExtendId      int64
          ExtendContent string
          TestDateTime  *time.Time
       }
   
    
   
   
        func (baseTestRpcbo BaseTestRpcBO) JavaClassName() string {
              return "xx.xx.xx.BaseTestRpcBO"
        }
   
   
   
       type TestRpcBO struct {
          BaseTestRpcBO
          ExtendId      int64
          ExtendContent string
       }
   
   
       
       func (testRpcBo TestRpcBO) JavaClassName() string {
          return "xx.xx.xx.TestRpcBO"
       }
   
   
   
   
        type SecondTestRpcBO struct {
          BaseTestRpcBO
          SecondId      int32
          SecondContent string
        }
   
   
   
       func (secondTestRpcBo SecondTestRpcBO) JavaClassName() string {
        return "xx.xx.xx.secondTestRpcBO"
       }
   
   
       type LigoLastMsgInfo struct {
          MessageId   int32
          Text        string
          MessageTime time.Time
       }
   
   
   
        func (ligoLastMsgInfo LigoLastMsgInfo) JavaClassName() string {
            return "xx.xx.xx.LigoLastMsgInfo"
        }
   
   provider:
          
             type ChatSystemApi struct {
          // dubbo标签,用于适配go侧客户端大写方法名 -> java侧小写方法名,只有 dubbo 协议客户端才需要使用
                    SendMessage  func(ctx context.Context, from int64, message 
message.Message) (*CommResp, error)                                
`dubbo:"sendMessage"`
                    TestRpcApi   func(ctx context.Context, testContent string, 
testId int64, message message.Message) (*CommResp, error)          
`dubbo:"testRpcApi"`
                    TestRpcApiV2 func(ctx context.Context, testContent string, 
testId int64, baseTestRpcBO text.BaseTestRpcBO) (*CommResp, error) 
`dubbo:"testRpcApiV2"`
   }
   
             var (
                  TxtProvider *ChatSystemApi
             )
   
             func ProviderInit() {
                  TxtProvider = &ChatSystemApi{}
                  //    注册客户端存根类到框架,实例化客户端接口指针
                  config.SetConsumerService(TxtProvider)
             }
   
             func (msg ChatSystemApi) JavaClassName() string {
                  return "xx.xx.xx.ChatSystemApi"
             }
   **Anything else we need to know?**:
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to