package request import "encoding/xml" // SOAPRequestEnvelope define la estructura general del mensaje SOAP. type SOAPRequestEnvelopeCufd struct { XMLName xml.Name `xml:"soapenv:Envelope"` XmlnsSoapenv string `xml:"xmlns:soapenv,attr"` // URL del namespace SOAP XmlnsSiat string `xml:"xmlns:siat,attr"` // URL del namespace siat Header *SOAPRequestHeaderCufd `xml:"soapenv:Header,omitempty"` Body SOAPRequestBodyCufd `xml:"soapenv:Body"` } type SOAPRequestHeaderCufd struct{} type SOAPRequestBodyCufd struct { Operacion OperacionXMLCufd `xml:",any,omitempty"` } type OperacionXMLCufd struct { XMLName xml.Name Solicitud SolicitudCuisCufd `xml:"SolicitudCufd"` } // permite controlar la serialización de OperacionXML para usar el nombre de etiqueta deseado. func (o OperacionXMLCufd) MarshalXML2(e *xml.Encoder, start xml.StartElement) error { start.Name = o.XMLName // Encapsulamos la solicitud en una estructura anónima para que se serialice correctamente. return e.EncodeElement(struct { Solicitud SolicitudCuisCufd `xml:"SolicitudCufd"` }{o.Solicitud}, start) }