Hello,
I am fairly new to Go, coming from the Perl world. I am trying to re-implement a few things I wrote in Perl with Go to get some experience and learn the ropes.
One of my scripts is an XML-RPC client (using Perl’s Frontier::Client
module). As Perl does not have this built-in I chose github.com/kolo/xmlrpc
from the options in the Go universe.
I am now stuck at trying to authenticate and the documentation is sparse, not enabling me to figure it out myself. I have to send a username and a password and should get back a session key. Here is what I tried so far
client, _ := xmlrpc.NewClient("http://localhost/rpc/api", nil)
type Credentials struct {
Username, Password string
}
var creds = Credentials{"admin","admin1"}
client.Call("auth.login", &creds, &sessionkey)
Looking at a tcpdump, I see that the username and password field are transmitted inside a <struct>
tag, which is not what the server expects and so I don’t get a session key.
Any pointers would be greatly appreciated.
Cheers, Lordy