I am new to Go
(golang
) and I am doing a test for a SOAP-CLIENT
but I am not successful, I am implementing the following code but I do not receive any data:.
Install:
go get github.com/tiaguinho/gosoap
My code:
package main
import (
"log"
"github.com/tiaguinho/gosoap"
)
type LoginResponse struct {
LoginResult LoginResult
}
type LoginResult struct {
sid string
}
var (
r LoginResponse
)
func main() {
soap, err := gosoap.SoapClient("https://demo.ilias.de/webservice/soap/server.php?wsdl")
if err != nil {
log.Fatal("error not expected: ", err)
}
params := gosoap.Params{
"client": "asd",
"username": "asd",
"password": "asd",
}
err = soap.Call("login", params)
if err != nil {
log.Fatal("error in soap call: ", err)
}
soap.Unmarshal(&r)
if r.LoginResult.sid != "USA" {
log.Fatal("error: ", r)
}
}
My Error:
2018/09/10 06:48:38 error in soap call: expected element type <Envelope> but have <br>
exit status 1
I do not know how to solve the problem, Thanks for your time and help