Пытаюсь развернуть SOAP в GO структуру, ошибку не возвращает, но поле status остается пустым. Что я делаю не так?
package main
import (
"fmt"
"encoding/xml"
)
type myEnvelope struct {
XMLName xml.Name `xml:"Envelope"`
Body methodResponseData
}
type methodResponseData struct {
XMLName xml.Name
Status string `xml:"responseData>status"`
}
func main() {
resp := methodResponseData{}
resp.XMLName.Local = "SOAP-ENV:methodResponse"
envelope := myEnvelope{
Body: resp,
}
envelope.XMLName.Local = "Envelope"
envelope.Body.XMLName.Local = "Body"
raw := []byte(`
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope>
<SOAP-ENV:Body>
<SOAP-ENV:methodResponse>
<responseData>
<status>OK</status>
</responseData>
</SOAP-ENV:methodResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
`)
err := xml.Unmarshal(raw, &envelope)
if err != nil {
fmt.Printf("something wrong %s", err)
}
fmt.Printf("%s", envelope.Body.Status)
}