diff --git a/main.go b/main.go index b093af0..deb49a9 100644 --- a/main.go +++ b/main.go @@ -93,10 +93,20 @@ type GRI struct { // Register type REG struct { + XMLName xml.Name `xml:"Envelope"` + Version string `xml:"Body>Register>Version"` + DeviceId string `xml:"Body>Register>DeviceId"` + MessageId string `xml:"Body>Register>MessageId"` + AccountId string `xml:"Body>Register>AccountId"` + Country string `xml:"Body>Register>Country"` } // Unregister type UNR struct { + XMLName xml.Name `xml:"Envelope"` + Version string `xml:"Body>Unregister>Version"` + DeviceId string `xml:"Body>Unregister>DeviceId"` + MessageId string `xml:"Body>Unregister>MessageId"` } func main() { @@ -356,7 +366,26 @@ func handler(w http.ResponseWriter, r *http.Request) { } fmt.Println(REG) fmt.Println("The request is valid! Responding...") - fmt.Fprintf(w, ``) + fmt.Fprintf(w, ` + + + + `+REG.Version+` + `+REG.DeviceId+` + `+REG.MessageId+` + `+timestamp+` + 0 + false + `+REG.AccountId+` + 00000000 + `+REG.Country+` + + 00000000 + + +`) } else { @@ -372,7 +401,19 @@ func handler(w http.ResponseWriter, r *http.Request) { } fmt.Println(UNR) fmt.Println("The request is valid! Responding...") - fmt.Fprintf(w, ``) + fmt.Fprintf(w, ` + + + + `+UNR.Version+` + `+UNR.DeviceId+` + `+UNR.MessageId+` + `+timestamp+` + 0 + false + + +`) } else { fmt.Println("Nothing sent?")