diff --git a/SOAP-WSC/ECS/NotifyETicketsSynced.xml b/SOAP-WSC/ECS/NotifyETicketsSynced.xml deleted file mode 100644 index 4d84355..0000000 --- a/SOAP-WSC/ECS/NotifyETicketsSynced.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - -POST /ecs/services/ECommerceSOAP HTTP/1.1 -Host: ecs.shop.wii.com -User-Agent: RVL ECSHOP 4.8.0 Jul 27 2012 16:52:03 -Connection: Keep-Alive -Accept: application/xml -Accept-Charset: UTF-8 -Content-type: text/xml; charset=utf-8 -SOAPAction: urn:ecs.wsapi.broadon.com/NotifyETicketsSynced -Content-Length: 1089 - - - - - - 2.0 - ECSHOP-$DeviceId-$MessageId - $DeviceId - $DeviceToken - $AccountId - $Region - $Country - $Language - $SerialNo - 0 - $ExtTicketTime - $SyncTime - - - - - - -HTTP/1.1 200 OK -Date: Sat, 14 Jul 2018 12:23:12 GMT -Server: Apache/2.2.19 -Keep-Alive: timeout=15, max=300 -Connection: Keep-Alive -Transfer-Encoding: chunked -Content-Type: text/xml;charset=utf-8 - -23d - - - - - 2.0 - $DeviceId - ECSHOP-$DeviceId-$MessageId - $TimeStamp - 0 - false - - - -0 \ No newline at end of file diff --git a/SOAP-WSC/ECS/listETickets.xml b/SOAP-WSC/ECS/listETickets.xml deleted file mode 100644 index d3f051c..0000000 --- a/SOAP-WSC/ECS/listETickets.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - -POST /ecs/services/ECommerceSOAP HTTP/1.1 -Host: ecs.shop.wii.com -User-Agent: RVL ECSHOP 4.8.0 Jul 27 2012 16:52:03 -Connection: Keep-Alive -Accept: application/xml -Accept-Charset: UTF-8 -Content-type: text/xml; charset=utf-8 -SOAPAction: urn:ecs.wsapi.broadon.com/ListETickets -Content-Length: 922 - - - - - - 2.0 - ECSHOP-$DeviceId-$MessageId - $DeviceId - $DeviceToken - $AccountId - $Region - $Country - $Language - $SerialNo - - - - - -HTTP/1.1 200 OK -Date: Sun, 08 Jul 2018 12:04:22 GMT -Server: Apache/2.2.19 -Keep-Alive: timeout=15, max=300 -Connection: Keep-Alive -Transfer-Encoding: chunked -Content-Type: text/xml;charset=utf-8 - -a37 - - - - - 2.0 - $DeviceId - ECSHOP-$DeviceId-$MessageId - $TimeStamp - 0 - false - - - $TicketId - $TitleId - 0 - 0 - 0 - 0 - - - $TicketId - $TitleId - 0 - 0 - 0 - 0 - - - $TicketId - $TitleId - 0 - 0 - 0 - 0 - - 0 - 0 - $SyncTime - - - -0 \ No newline at end of file diff --git a/SOAP-WSC/ECS/purchaseTitle.xml b/SOAP-WSC/ECS/purchaseTitle.xml deleted file mode 100644 index 19010f2..0000000 --- a/SOAP-WSC/ECS/purchaseTitle.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - -POST /ecs/services/ECommerceSOAP HTTP/1.1 -Host: ecs.shop.wii.com -User-Agent: RVL ECSHOP 4.8.0 Jul 27 2012 16:52:03 -Connection: Keep-Alive -Accept: application/xml -Accept-Charset: UTF-8 -Content-type: text/xml; charset=utf-8 -SOAPAction: urn:ecs.wsapi.broadon.com/PurchaseTitle -Content-Length: 2030 - - - - - - 2.0 - ECSHOP-$DeviceId-$MessageId - $DeviceId - $DeviceToken - $AccountId - $Region - $Country - $Language - $SerialNo - $ItemId - - $Amount - POINTS - - 0 - - ACCOUNT - - $AccountNumber - $DeviceToken - - - $DeviceCert - $TitleId - - 0 - $LimitKind - - - - - - -HTTP/1.1 200 OK -Date: Mon, 09 Jul 2018 07:43:59 GMT -Server: Apache/2.2.19 -Keep-Alive: timeout=15, max=300 -Connection: Keep-Alive -Transfer-Encoding: chunked -Content-Type: text/xml;charset=utf-8 - -1040 - - - - - 2.0 - $DeviceId - ECSHOP-$DeviceId-$MessageId - $TimeStamp - 0 - false - - $Amount - POINTS - - - $TransactionId - $Date - PURCHGAME - - $Date - $ETickets - $Certs - $Certs - $TitleId - - - -0 diff --git a/SOAP-WSC/IAS/checkRegistration.xml b/SOAP-WSC/IAS/checkRegistration.xml deleted file mode 100644 index eaa7da5..0000000 --- a/SOAP-WSC/IAS/checkRegistration.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - -POST /ias/services/IdentityAuthenticationSOAP HTTP/1.1 -Host: ias.shop.wii.com -User-Agent: RVL ECSHOP 4.8.0 Jul 27 2012 16:52:03 -Connection: Keep-Alive -Accept: application/xml -Accept-Charset: UTF-8 -Content-type: text/xml; charset=utf-8 -SOAPAction: urn:ias.wsapi.broadon.com/CheckRegistration -Content-Length: 829 - - - - - - 2.0 - ECSHOP-$DeviceId-$MessageId - $DeviceId - $Region - $Country - $Language - $SerialNumber - - - - - - -HTTP/1.1 200 OK -Date: Sun, 08 Jul 2018 12:57:25 GMT -Server: Apache/2.2.19 -Keep-Alive: timeout=15, max=300 -Connection: Keep-Alive -Transfer-Encoding: chunked -Content-Type: text/xml;charset=utf-8 - -282 - - - - - 2.0 - $DeviceId - ECSHOP-$DeviceId-$MessageId - $TimeStamp - 0 - false - - $DeviceStatus - - - -0 \ No newline at end of file diff --git a/SOAP-WSC/IAS/getRegistrationInfo.xml b/SOAP-WSC/IAS/getRegistrationInfo.xml deleted file mode 100644 index ba20c42..0000000 --- a/SOAP-WSC/IAS/getRegistrationInfo.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - -POST /ias/services/IdentityAuthenticationSOAP HTTP/1.1 -Host: ias.shop.wii.com -User-Agent: RVL ECSHOP 4.8.0 Jul 27 2012 16:52:03 -Connection: Keep-Alive -Accept: application/xml -Accept-Charset: UTF-8 -Content-type: text/xml; charset=utf-8 -SOAPAction: urn:ias.wsapi.broadon.com/GetRegistrationInfo -Content-Length: 2140 - - - - - - 2.0 - ECSHOP-$DeviceId-$MessageId - $DeviceId - $DeviceToken - $AccountId - $Region - $Country - $Language - $DeviceCert - $Signature - $CertChain - $Challenge - - - - - -HTTP/1.1 200 OK -Date: Sat, 14 Jul 2018 12:23:01 GMT -Server: Apache/2.2.19 -Keep-Alive: timeout=15, max=300 -Connection: Keep-Alive -Transfer-Encoding: chunked -Content-Type: text/xml;charset=utf-8 - -34d - - - - - 2.0 - $DeviceId - ECSHOP-$DeviceId-$MessageId - $TimeStamp - 0 - false - $AccountId - $DeviceToken - false - AU - - 0000000000000000 - R - POINTS - - - -0 \ No newline at end of file diff --git a/SOAP-WSC/IAS/registerAccount.xml b/SOAP-WSC/IAS/registerAccount.xml deleted file mode 100644 index b1eba7f..0000000 --- a/SOAP-WSC/IAS/registerAccount.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - -POST /ias/services/IdentityAuthenticationSOAP HTTP/1.1 -Host: ias.shop.wii.com -User-Agent: RVL ECSHOP 4.8.0 Jul 27 2012 16:52:03 -Connection: Keep-Alive -Accept: application/xml -Accept-Charset: UTF-8 -Content-type: text/xml; charset=utf-8 -SOAPAction: urn:ias.wsapi.broadon.com/Register -Content-Length: 2360 - - - - - - 2.0 - $MsgId - $DevId - $DevToken - $AccId - $Reg - $Country - $Language - $DevCert - $SerNo - $RegisReg - $Sign - $CertChain - $Challenge - $WifiMac - $BTMac - $DevCode - - - - - - - diff --git a/SOAP-WSC/IAS/removeAccount.xml b/SOAP-WSC/IAS/removeAccount.xml deleted file mode 100644 index daeb155..0000000 --- a/SOAP-WSC/IAS/removeAccount.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - -POST /ias/services/IdentityAuthenticationSOAP HTTP/1.1 -Host: ias.shop.wii.com -User-Agent: RVL ECSHOP 4.8.0 Jul 27 2012 16:52:03 -Connection: Keep-Alive -Accept: application/xml -Accept-Charset: UTF-8 -Content-type: text/xml; charset=utf-8 -SOAPAction: urn:ias.wsapi.broadon.com/Unregister -Content-Length: 2165 - - - - - - 2.0 - $MsgId - $DevId - $DevToken - $AccId - $Reg - $Country - $Language - $DevCert - $SerNo - $Sign - $CertChain - $Challenge - - - - - - - -HTTP/1.1 200 OK -Date: Sun, 08 Jul 2018 12:56:35 GMT -Server: Apache/2.2.19 -Keep-Alive: timeout=15, max=300 -Connection: Keep-Alive -Transfer-Encoding: chunked -Content-Type: text/xml;charset=utf-8 - -229 - - - - - 2.0 - $DevId - $MsgId - $TimeStamp - $ErrCode - false - - - -0 diff --git a/main.go b/main.go index fe86db1..fd05aa1 100644 --- a/main.go +++ b/main.go @@ -4,34 +4,44 @@ import ( "encoding/xml" "fmt" "io/ioutil" + "log" "net/http" ) // The Check struct(ure) will attempt to retrieve all the namespace data. // Assuming that namespaces that don't exist are given a "nil", the first result that isn't a "nil" will be used as the template response. +const ( + // Header is a generic XML header suitable for use with the output of Marshal. + // This is not automatically added to any output of this package, + // it is provided as a convenience. + Header = `` + "\n" +) type Check struct { + + // SOAP envelope doesn't matter to OSC. We'll only need the BODY. + SOAP xml.Name `xml:"SOAP-ENV:Body"` + // ECommerce Namespaces - CDS string `ecs:"CheckDeviceStatus"` - LET string `ecs:"ListETickets"` - NETS string `ecs:"NotifyETicketsSynced"` - PT string `ecs:"PurchaseTitle"` + CDS string `xml:"CheckDeviceStatus>Version"` + LET string `xml:"ListETickets>Version"` + NETS string `xml:"NotifyETicketsSynced>Version"` + PT string `xml:"PurchaseTitle>Version"` // Identity Authentication Namespaces - CR string `ecs:"CheckRegistration"` - GRI string `ecs:"GetRegistrationInfo"` - REG string `ecs:"Register"` - UNR string `ecs:"Unregister"` + CR string `ias:"CheckRegistration>Version"` + GRI string `ias:"GetRegistrationInfo>Version"` + REG string `ias:"Register>Version"` + UNR string `ias:"Unregister>Version"` } 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. - // This is probably my favourite thing in GoLang to be honest. - if err != nil { - panic(err) - return - } + fmt.Println("Starting HTTP connection (Port 8000)...") + http.HandleFunc("/", handler) // each request calls handler + log.Fatal(http.ListenAndServe(":8000", nil)) +} + +func handler(w http.ResponseWriter, r *http.Request) { ChRes := Check{ CDS: "", LET: "", @@ -42,13 +52,18 @@ func main() { REG: "", UNR: "", } - err = xml.Unmarshal(file, &ChRes) + body, err := ioutil.ReadAll(r.Body) if err != nil { + http.Error(w, "Error reading request body", + http.StatusInternalServerError) + } + + err = xml.Unmarshal([]byte(body), &ChRes) + if err != nil { + fmt.Println(ChRes) + fmt.Fprint(w, "What do you think you are doing?") fmt.Printf("error: %v", err) return } 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(":80", nil) }