I'm implementing a service in our Go system that reads data from an external SOAP service. Now that I'm writing tests for it, I run into this issue:
unable to unmarshal request body for testing: expected element type <soapenv:Envelope> but have <Envelope>
If I dump my data, I have this:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:v2 [...]
So I do have the correct namespace in the XML. For the record, this is the struct into which I'm trying to unmarshal the data:
type collectRequestXML struct {
XMLName xml.Name `xml:"soapenv:Envelope"`
SoapEnv string `xml:"xmlns:soapenv,attr"`
XMLNs string `xml:"xmlns:v2,attr"`
Header struct{} `xml:"soapenv:Header"`
Body struct {
[...]
}
}
What can I do to make the unmarshal fail?