in protocol/dubbo/impl/hessian.go [198:269]
func unmarshalRequestBody(body []byte, p *DubboPackage) error {
if p.Body == nil {
p.SetBody(make([]interface{}, 7))
}
decoder := hessian.NewDecoder(body)
var (
err error
dubboVersion, target, serviceVersion, method, argsTypes interface{}
args []interface{}
)
req, ok := p.Body.([]interface{})
if !ok {
return perrors.Errorf("@reqObj is not of type: []interface{}")
}
dubboVersion, err = decoder.Decode()
if err != nil {
return perrors.WithStack(err)
}
req[0] = dubboVersion
target, err = decoder.Decode()
if err != nil {
return perrors.WithStack(err)
}
req[1] = target
serviceVersion, err = decoder.Decode()
if err != nil {
return perrors.WithStack(err)
}
req[2] = serviceVersion
method, err = decoder.Decode()
if err != nil {
return perrors.WithStack(err)
}
req[3] = method
argsTypes, err = decoder.Decode()
if err != nil {
return perrors.WithStack(err)
}
req[4] = argsTypes
ats := hessian.DescRegex.FindAllString(argsTypes.(string), -1)
var arg interface{}
for i := 0; i < len(ats); i++ {
arg, err = decoder.Decode()
if err != nil {
return perrors.WithStack(err)
}
args = append(args, arg)
}
req[5] = args
attachments, err := decoder.Decode()
if err != nil {
return perrors.WithStack(err)
}
if attachments == nil || attachments == "" {
attachments = map[interface{}]interface{}{constant.InterfaceKey: target}
}
if v, ok := attachments.(map[interface{}]interface{}); ok {
v[DUBBO_VERSION_KEY] = dubboVersion
req[6] = ToMapStringInterface(v)
buildServerSidePackageBody(p)
return nil
}
return perrors.Errorf("get wrong attachments: %+v", attachments)
}