mirror of
https://wiilab.wiimart.org/wiimart/WiiSOAP
synced 2025-09-05 21:11:02 +02:00
It's messy rn, but I'll clean it up. uwu
This commit is contained in:
parent
c5454ab7c2
commit
7734e5d911
5
config.json
Normal file
5
config.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"SQLUser":"username",
|
||||||
|
"SQLPass":"password",
|
||||||
|
"Port":"2018"
|
||||||
|
}
|
16
core.go
Normal file
16
core.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
_ "github.com/go-sql-driver/mysql"
|
||||||
|
"log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func StartSQL() {
|
||||||
|
db, err := sql.Open("mysql",
|
||||||
|
"opensoap:@tcp(127.0.0.1:3306)/hello")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
defer db.Close()
|
||||||
|
}
|
19
main.go
19
main.go
@ -19,8 +19,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
_ "github.com/go-sql-driver/mysql"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -35,7 +37,24 @@ const (
|
|||||||
Header = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"
|
Header = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var configs []Config
|
||||||
|
|
||||||
|
// CheckError makes error handling not as ugly and inefficient.
|
||||||
|
func CheckError(e error) {
|
||||||
|
if e != nil {
|
||||||
|
log.Fatal("There has been an error while performing this action. Reason: ", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
configblob, err := ioutil.ReadFile("config.json")
|
||||||
|
CheckError(err)
|
||||||
|
err = json.Unmarshal(configblob, &configs)
|
||||||
|
CheckError(err)
|
||||||
|
|
||||||
|
fmt.Println("Open SOAP-GO for Server Environments.")
|
||||||
|
fmt.Println("Initializing core...")
|
||||||
|
|
||||||
fmt.Println("Starting HTTP connection (Port 2018)...")
|
fmt.Println("Starting HTTP connection (Port 2018)...")
|
||||||
fmt.Println("NOTICE: The SOAP Server runs under a port that doesn't work with WSC naturally.")
|
fmt.Println("NOTICE: The SOAP Server runs under a port that doesn't work with WSC naturally.")
|
||||||
fmt.Println("You can either use proxying from Nginx (recommended) or another web server software, or edit this script to use port 80.")
|
fmt.Println("You can either use proxying from Nginx (recommended) or another web server software, or edit this script to use port 80.")
|
||||||
|
@ -24,6 +24,12 @@ import "encoding/xml"
|
|||||||
/////////////////////
|
/////////////////////
|
||||||
// The structures may seem repetitive and redundant, but blame WSC's inconsistent SOAP requests.
|
// The structures may seem repetitive and redundant, but blame WSC's inconsistent SOAP requests.
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
SQLUser string
|
||||||
|
SQLPass string
|
||||||
|
Port string
|
||||||
|
}
|
||||||
|
|
||||||
// CheckDeviceStatus
|
// CheckDeviceStatus
|
||||||
type CDS struct {
|
type CDS struct {
|
||||||
XMLName xml.Name `xml:"Envelope"`
|
XMLName xml.Name `xml:"Envelope"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user