not working, but its something

This commit is contained in:
CornierKhan1 2018-08-26 17:00:38 +10:00
parent 0842985b84
commit 958a3605f1

13
main.go
View File

@ -1,7 +1,9 @@
package main package main
import ( import (
"encoding/xml"
"fmt" "fmt"
"io/ioutil"
"net/http" "net/http"
) )
@ -23,9 +25,13 @@ type Check struct {
} }
func main() { func main() {
file, err := ioutil.ReadFile("SOAP-WSC/ECS/checkDeviceStatus.xml")
// ChRes is a variable that's in the form of JSON. This organises all the data into sub-variables like ChRes.CDS. // ChRes is a variable that's in the form of JSON. This organises all the data into sub-variables like ChRes.CDS.
// This is probably my favourite thing in GoLang to be honest. // This is probably my favourite thing in GoLang to be honest.
if err != nil {
panic(err)
return
}
ChRes := Check{ ChRes := Check{
CDS: "", CDS: "",
LET: "", LET: "",
@ -36,6 +42,11 @@ func main() {
REG: "", REG: "",
UNR: "", UNR: "",
} }
err = xml.Unmarshal(file, &ChRes)
if err != nil {
fmt.Printf("error: %v", err)
return
}
fmt.Println(ChRes) fmt.Println(ChRes)
// http.ListenAndServe starts a HTTP server, which is important to take note of as we will be using this to deliver the SOAP. // http.ListenAndServe starts a HTTP server, which is important to take note of as we will be using this to deliver the SOAP.