44 lines
1.6 KiB
Go
44 lines
1.6 KiB
Go
package request
|
|
|
|
import "encoding/xml"
|
|
|
|
// SOAPRequestEnvelope define la estructura general del mensaje SOAP.
|
|
type SOAPRequestEnvelope 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 *SOAPRequestHeader `xml:"soapenv:Header,omitempty"`
|
|
//Body SOAPRequestBody `xml:"soapenv:Body"`
|
|
Body SOAPRequestBody `xml:"soapenv:Body"`
|
|
}
|
|
|
|
type SOAPRequestHeader struct{}
|
|
|
|
type SOAPRequestBody struct {
|
|
Operacion OperacionXML `xml:",any"`
|
|
}
|
|
|
|
type OperacionXML struct {
|
|
XMLName xml.Name
|
|
Solicitud SolicitudSincronizacion `xml:"SolicitudSincronizacion"`
|
|
}
|
|
|
|
// MarshalXML permite controlar la serialización de OperacionXML para usar el nombre de etiqueta deseado.
|
|
func (o OperacionXML) MarshalXML(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 SolicitudSincronizacion `xml:"SolicitudSincronizacion"`
|
|
}{o.Solicitud}, start)
|
|
}
|
|
|
|
// SolicitudSincronizacion representa la información de la sincronización que se debe enviar.
|
|
type SolicitudSincronizacion struct {
|
|
CodigoAmbiente string `xml:"codigoAmbiente,omitempty"`
|
|
CodigoPuntoVenta string `xml:"codigoPuntoVenta,omitempty"`
|
|
CodigoSistema string `xml:"codigoSistema,omitempty"`
|
|
CodigoSucursal string `xml:"codigoSucursal,omitempty"`
|
|
Cuis string `xml:"cuis,omitempty"`
|
|
Nit string `xml:"nit,omitempty"`
|
|
}
|