MasterKenway edited a comment on issue #240:
URL: https://github.com/apache/dubbo-go-pixiu/issues/240#issuecomment-899054471


   After my debug and discuss with @xavier-niu, I changed my code to 
   
   In dubbo protocol client call method:
   ```
   // Call invoke service
   func (dc *Client) Call(req *client.Request) (res interface{}, err error) {
        // method, paramType, paramValue
        gsReq := make([]interface{}, 3)
        // if GET with no args, values would be nil
        values, err := dc.genericArgs(req)
        if err != nil {
                return nil, err
        }
        val, ok := values.(*dubboTarget)
        if !ok {
                return nil, errors.New("map parameters failed")
        }
   
        dm := req.API.Method.IntegrationRequest
        method := dm.Method
        gsReq[0] = method
   
        if val != nil {
                logger.Debugf("[dubbo-go-pixiu] dubbo invoke, method:%s, 
types:%s, reqData:%v", method, val.Types, val.Values)
                gsReq[1], gsReq[2] = val.Types, val.Values
        } else {
                logger.Debugf("[dubbo-go-pixiu] dubbo invoke, method:%s, 
types:%s, reqData:%v", method, nil, nil)
                gsReq[1], gsReq[2] = []hessian.Object{}, []hessian.Object{}
        }
   
        gs := dc.Get(dm)
   
        rst, err := gs.Invoke(req.Context, gsReq)
        if err != nil {
                return nil, err
        }
   
        logger.Debugf("[dubbo-go-pixiu] dubbo client resp:%v", rst)
   
        return rst, nil
   }
   ```
   
   But this lead to pixiu error: 
   ```
   2021-08-17T17:08:37.216+0800 ERROR   dubbo/dubbo_codec.go:245        
pkg.Unmarshal(len(@data):0) = error:can not find go type name 
com.dubbogo.pixiu.User in registry
   github.com/apache/dubbo-go-hessian2.(*Decoder).getStructDefByIndex
        
D:/WorkSpace/GoLandProjects/dubbo-go-pixiu/vendor/github.com/apache/dubbo-go-hessian2/object.go:576
   github.com/apache/dubbo-go-hessian2.(*Decoder).decObject
        
D:/WorkSpace/GoLandProjects/dubbo-go-pixiu/vendor/github.com/apache/dubbo-go-hessian2/object.go:678
   github.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue
        
D:/WorkSpace/GoLandProjects/dubbo-go-pixiu/vendor/github.com/apache/dubbo-go-hessian2/decode.go:285
   github.com/apache/dubbo-go-hessian2.(*Decoder).decObject
        
D:/WorkSpace/GoLandProjects/dubbo-go-pixiu/vendor/github.com/apache/dubbo-go-hessian2/object.go:652
   github.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue
        
D:/WorkSpace/GoLandProjects/dubbo-go-pixiu/vendor/github.com/apache/dubbo-go-hessian2/decode.go:285
   github.com/apache/dubbo-go-hessian2.(*Decoder).readUntypedList
        
D:/WorkSpace/GoLandProjects/dubbo-go-pixiu/vendor/github.com/apache/dubbo-go-hessian2/list.go:414
   github.com/apache/dubbo-go-hessian2.(*Decoder).decList
        
D:/WorkSpace/GoLandProjects/dubbo-go-pixiu/vendor/github.com/apache/dubbo-go-hessian2/list.go:284
   github.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue
        
D:/WorkSpace/GoLandProjects/dubbo-go-pixiu/vendor/github.com/apache/dubbo-go-hessian2/decode.go:278
   github.com/apache/dubbo-go-hessian2.(*Decoder).Decode
   ```


-- 
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