some more edits (added HTTP)

This commit is contained in:
CornierKhan1 2018-08-26 21:19:12 +10:00
parent 958a3605f1
commit 7a16cfd885
8 changed files with 34 additions and 540 deletions

View File

@ -1,68 +0,0 @@
<!--
OSC Note:
This SOAP template is for NotifyETicketsSynced.
Sensitive information such as the account holder's data was censored.
-->
<!-- Request -->
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
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecs="urn:ecs.wsapi.broadon.com">
<SOAP-ENV:Body>
<ecs:NotifyETicketsSynced xsi:type="ecs:NotifyETicketsSyncedRequestType">
<ecs:Version>2.0</ecs:Version>
<ecs:MessageId>ECSHOP-$DeviceId-$MessageId</ecs:MessageId>
<ecs:DeviceId>$DeviceId</ecs:DeviceId>
<ecs:DeviceToken>$DeviceToken</ecs:DeviceToken>
<ecs:AccountId>$AccountId</ecs:AccountId>
<ecs:Region>$Region</ecs:Region>
<ecs:Country>$Country</ecs:Country>
<ecs:Language>$Language</ecs:Language>
<ecs:SerialNo>$SerialNo</ecs:SerialNo>
<ecs:ForceSyncTime>0</ecs:ForceSyncTime>
<ecs:ExtTicketTime>$ExtTicketTime</ecs:ExtTicketTime>
<ecs:SyncTime>$SyncTime</ecs:SyncTime>
</ecs:NotifyETicketsSynced>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<!-- Response -->
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
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<NotifyETicketsSyncedResponse xmlns="urn:ecs.wsapi.broadon.com">
<Version>2.0</Version>
<DeviceId>$DeviceId</DeviceId>
<MessageId>ECSHOP-$DeviceId-$MessageId</MessageId>
<TimeStamp>$TimeStamp</TimeStamp>
<ErrorCode>0</ErrorCode>
<ServiceStandbyMode>false</ServiceStandbyMode>
</NotifyETicketsSyncedResponse>
</soapenv:Body>
</soapenv:Envelope>
0

View File

@ -1,97 +0,0 @@
<!--
OSC Note:
The following SOAP Template is for listing your ETickets from WSC.
To protect the donor's information, the actual statements inside the SOAP has been censored.
-->
<!-- Request -->
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
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecs="urn:ecs.wsapi.broadon.com">
<SOAP-ENV:Body>
<ecs:ListETickets xsi:type="ecs:ListETicketsRequestType">
<ecs:Version>2.0</ecs:Version>
<ecs:MessageId>ECSHOP-$DeviceId-$MessageId</ecs:MessageId>
<ecs:DeviceId>$DeviceId</ecs:DeviceId>
<ecs:DeviceToken>$DeviceToken</ecs:DeviceToken>
<ecs:AccountId>$AccountId</ecs:AccountId>
<ecs:Region>$Region</ecs:Region>
<ecs:Country>$Country</ecs:Country>
<ecs:Language>$Language</ecs:Language>
<ecs:SerialNo>$SerialNo</ecs:SerialNo>
</ecs:ListETickets>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<!-- Response -->
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
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ListETicketsResponse xmlns="urn:ecs.wsapi.broadon.com">
<Version>2.0</Version>
<DeviceId>$DeviceId</DeviceId>
<MessageId>ECSHOP-$DeviceId-$MessageId</MessageId>
<TimeStamp>$TimeStamp</TimeStamp>
<ErrorCode>0</ErrorCode>
<ServiceStandbyMode>false</ServiceStandbyMode>
<!--
OSC Note:
<Tickets></Tickets> exists to state that an account owns a WSC Channel Ticket.
The <Tickets> section is copied as many times as the amount of channels that the account owns.
If the account owns 5 channels, the <Tickets></Tickets> will be listed five times.
To convey a proper example, this SOAP Template states that this example account owns THREE -->
<Tickets>
<TicketId>$TicketId</TicketId>
<TitleId>$TitleId</TitleId>
<RevokeDate>0</RevokeDate>
<Version>0</Version>
<MigrateCount>0</MigrateCount>
<MigrateLimit>0</MigrateLimit>
</Tickets>
<Tickets>
<TicketId>$TicketId</TicketId>
<TitleId>$TitleId</TitleId>
<RevokeDate>0</RevokeDate>
<Version>0</Version>
<MigrateCount>0</MigrateCount>
<MigrateLimit>0</MigrateLimit>
</Tickets>
<Tickets>
<TicketId>$TicketId</TicketId>
<TitleId>$TitleId</TitleId>
<RevokeDate>0</RevokeDate>
<Version>0</Version>
<MigrateCount>0</MigrateCount>
<MigrateLimit>0</MigrateLimit>
</Tickets>
<ForceSyncTime>0</ForceSyncTime>
<ExtTicketTime>0</ExtTicketTime>
<SyncTime>$SyncTime</SyncTime>
</ListETicketsResponse>
</soapenv:Body>
</soapenv:Envelope>
0

View File

@ -1,97 +0,0 @@
<!--
OSC Note:
The following SOAP Template is for purchasing a title of WSC.
To protect the donor's information, the actual statements inside the SOAP has been censored.
-->
<!-- Request -->
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
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecs="urn:ecs.wsapi.broadon.com">
<SOAP-ENV:Body>
<ecs:PurchaseTitle xsi:type="ecs:PurchaseTitleRequestType">
<ecs:Version>2.0</ecs:Version>
<ecs:MessageId>ECSHOP-$DeviceId-$MessageId</ecs:MessageId>
<ecs:DeviceId>$DeviceId</ecs:DeviceId>
<ecs:DeviceToken>$DeviceToken</ecs:DeviceToken>
<ecs:AccountId>$AccountId</ecs:AccountId>
<ecs:Region>$Region</ecs:Region>
<ecs:Country>$Country</ecs:Country>
<ecs:Language>$Language</ecs:Language>
<ecs:SerialNo>$SerialNo</ecs:SerialNo>
<ecs:ItemId>$ItemId</ecs:ItemId>
<ecs:Price>
<ecs:Amount>$Amount</ecs:Amount>
<ecs:Currency>POINTS</ecs:Currency>
</ecs:Price>
<ecs:Discount>0</ecs:Discount>
<ecs:Payment>
<ecs:PaymentMethod>ACCOUNT</ecs:PaymentMethod>
<ecs:AccountPayment>
<ecs:AccountNumber>$AccountNumber</ecs:AccountNumber>
<ecs:DeviceToken>$DeviceToken</ecs:DeviceToken>
</ecs:AccountPayment>
</ecs:Payment>
<ecs:DeviceCert>$DeviceCert</ecs:DeviceCert>
<ecs:TitleId>$TitleId</ecs:TitleId>
<ecs:Limits>
<ecs:Limits>0</ecs:Limits>
<ecs:LimitKind>$LimitKind</ecs:LimitKind>
</ecs:Limits>
</ecs:PurchaseTitle>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<!-- Response -->
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
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<PurchaseTitleResponse xmlns="urn:ecs.wsapi.broadon.com">
<Version>2.0</Version>
<DeviceId>$DeviceId</DeviceId>
<MessageId>ECSHOP-$DeviceId-$MessageId</MessageId>
<TimeStamp>$TimeStamp</TimeStamp>
<ErrorCode>0</ErrorCode>
<ServiceStandbyMode>false</ServiceStandbyMode>
<Balance>
<Amount>$Amount</Amount>
<Currency>POINTS</Currency>
</Balance>
<Transactions>
<TransactionId>$TransactionId</TransactionId>
<Date>$Date</Date>
<Type>PURCHGAME</Type>
</Transactions>
<SyncTime>$Date</SyncTime>
<ETickets>$ETickets</ETickets>
<Certs>$Certs</Certs>
<Certs>$Certs</Certs>
<TitleId>$TitleId</TitleId>
</PurchaseTitleResponse>
</soapenv:Body>
</soapenv:Envelope>
0

View File

@ -1,66 +0,0 @@
<!--
OSC Note:
This is an IAS SOAP Template for checking if a Wii Shop Account is registered.
The actual contents between each XML Statement have been censored for security reasons.
-->
<!-- Request -->
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
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ias="urn:ias.wsapi.broadon.com">
<SOAP-ENV:Body>
<ias:CheckRegistration xsi:type="ias:CheckRegistrationRequestType">
<ias:Version>2.0</ias:Version>
<ias:MessageId>ECSHOP-$DeviceId-$MessageId</ias:MessageId>
<ias:DeviceId>$DeviceId</ias:DeviceId>
<ias:Region>$Region</ias:Region>
<ias:Country>$Country</ias:Country>
<ias:Language>$Language</ias:Language>
<ias:SerialNumber>$SerialNumber</ias:SerialNumber>
</ias:CheckRegistration>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<!-- Response -->
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
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<CheckRegistrationResponse xmlns="urn:ias.wsapi.broadon.com">
<Version>2.0</Version>
<DeviceId>$DeviceId</DeviceId>
<MessageId>ECSHOP-$DeviceId-$MessageId</MessageId>
<TimeStamp>$TimeStamp</TimeStamp>
<ErrorCode>0</ErrorCode>
<ServiceStandbyMode>false</ServiceStandbyMode>
<OriginalSerialNumber></OriginalSerialNumber>
<DeviceStatus>$DeviceStatus</DeviceStatus>
</CheckRegistrationResponse>
</soapenv:Body>
</soapenv:Envelope>
0

View File

@ -1,75 +0,0 @@
<!--
OSC Note:
This is the SOAP template for getting registration information.
For security reasons, the information inside the statements have been censored with variable like statements.
-->
<!-- Request -->
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
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ias="urn:ias.wsapi.broadon.com">
<SOAP-ENV:Body>
<ias:GetRegistrationInfo xsi:type="ias:GetRegistrationInfoRequestType">
<ias:Version>2.0</ias:Version>
<ias:MessageId>ECSHOP-$DeviceId-$MessageId</ias:MessageId>
<ias:DeviceId>$DeviceId</ias:DeviceId>
<ias:DeviceToken>$DeviceToken</ias:DeviceToken>
<ias:AccountId>$AccountId</ias:AccountId>
<ias:Region>$Region</ias:Region>
<ias:Country>$Country</ias:Country>
<ias:Language>$Language</ias:Language>
<ias:DeviceCert>$DeviceCert</ias:DeviceCert>
<ias:Signature>$Signature</ias:Signature>
<ias:CertChain>$CertChain</ias:CertChain>
<ias:Challenge>$Challenge</ias:Challenge>
</ias:GetRegistrationInfo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<!-- Response -->
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
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<GetRegistrationInfoResponse xmlns="urn:ias.wsapi.broadon.com">
<Version>2.0</Version>
<DeviceId>$DeviceId</DeviceId>
<MessageId>ECSHOP-$DeviceId-$MessageId</MessageId>
<TimeStamp>$TimeStamp</TimeStamp>
<ErrorCode>0</ErrorCode>
<ServiceStandbyMode>false</ServiceStandbyMode>
<AccountId>$AccountId</AccountId>
<DeviceToken>$DeviceToken</DeviceToken>
<DeviceTokenExpired>false</DeviceTokenExpired>
<Country>AU</Country>
<ExtAccountId></ExtAccountId>
<DeviceCode>0000000000000000</DeviceCode>
<DeviceStatus>R</DeviceStatus>
<Currency>POINTS</Currency>
</GetRegistrationInfoResponse>
</soapenv:Body>
</soapenv:Envelope>
0

View File

@ -1,49 +0,0 @@
<!--
OSC Note:
This is an IAS SOAP Template for registering a Wii Shop Account.
The actual contents between each XML Statement have been censored for security reasons.
-->
<!-- Request -->
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
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ias="urn:ias.wsapi.broadon.com">
<SOAP-ENV:Body>
<ias:Register xsi:type="ias:RegisterRequestType">
<ias:Version>2.0</ias:Version>
<ias:MessageId>$MsgId</ias:MessageId>
<ias:DeviceId>$DevId</ias:DeviceId>
<ias:DeviceToken>$DevToken</ias:DeviceToken>
<ias:AccountId>$AccId</ias:AccountId>
<ias:Region>$Reg</ias:Region>
<ias:Country>$Country</ias:Country>
<ias:Language>$Language</ias:Language>
<ias:DeviceCert>$DevCert</ias:DeviceCert>
<ias:SerialNumber>$SerNo</ias:SerialNumber>
<ias:RegisterRegion>$RegisReg</ias:RegisterRegion>
<ias:Signature>$Sign</ias:Signature>
<ias:CertChain>$CertChain</ias:CertChain>
<ias:Challenge>$Challenge</ias:Challenge>
<ias:WifiMac>$WifiMac</ias:WifiMac>
<ias:BluetoothMac>$BTMac</ias:BluetoothMac>
<ias:DeviceCode>$DevCode</ias:DeviceCode>
</ias:Register>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<!-- Response -->

View File

@ -1,69 +0,0 @@
<!--
OSC Note:
This is an IAS SOAP Template for removing your Wii Shop Account.
The actual contents between each XML Statement have been censored for security reasons.
-->
<!-- Request -->
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
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ias="urn:ias.wsapi.broadon.com">
<SOAP-ENV:Body>
<ias:Unregister xsi:type="ias:UnregisterRequestType">
<ias:Version>2.0</ias:Version>
<ias:MessageId>$MsgId</ias:MessageId>
<ias:DeviceId>$DevId</ias:DeviceId>
<ias:DeviceToken>$DevToken</ias:DeviceToken>
<ias:AccountId>$AccId</ias:AccountId>
<ias:Region>$Reg</ias:Region>
<ias:Country>$Country</ias:Country>
<ias:Language>$Language</ias:Language>
<ias:DeviceCert>$DevCert</ias:DeviceCert>
<ias:SerialNumber>$SerNo</ias:SerialNumber>
<ias:Signature>$Sign</ias:Signature>
<ias:CertChain>$CertChain</ias:CertChain>
<ias:Challenge>$Challenge</ias:Challenge>
</ias:Unregister>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<!-- Response -->
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
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<UnregisterResponse xmlns="urn:ias.wsapi.broadon.com">
<Version>2.0</Version>
<DeviceId>$DevId</DeviceId>
<MessageId>$MsgId</MessageId>
<TimeStamp>$TimeStamp</TimeStamp>
<ErrorCode>$ErrCode</ErrorCode>
<ServiceStandbyMode>false</ServiceStandbyMode>
</UnregisterResponse>
</soapenv:Body>
</soapenv:Envelope>
0

51
main.go
View File

@ -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 = `<?xml version="1.0" encoding="UTF-8"?>` + "\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)
}