草庐IT

golang XML : unmarshal ignores namespace

我正在我们的Go系统中实现一项服务,该服务从外部SOAP服务读取数据。现在我正在为它编写测试,我遇到了这个问题:unabletounmarshalrequestbodyfortesting:expectedelementtypebuthave如果我转储我的数据,我有这个:所以我在XML中确实有正确的命名空间。作为记录,这是我试图将数据解码到的结构:typecollectRequestXMLstruct{XMLNamexml.Name`xml:"soapenv:Envelope"`SoapEnvstring`xml:"xmlns:soapenv,attr"`XMLNsstring`xml