Example #1
0
func TryLogIn() (sessionId string, err error) {

	logInClient := partner.NewSoap(loginUrl, true, &partner.BasicAuth{username, password + token})

	//fmt.Println("\n" + sessionId + "\n")

	loginInfo := new(partner.Login)
	loginInfo.Username = username
	loginInfo.Password = password + token

	// Same error as before
	resp, err := logInClient.Login(loginInfo)

	if err != nil {
		return
	}

	// fmt.Println("\n" + resp.Result.SessionId)
	sessionId = resp.Result.SessionId
	return
}
Example #2
0
func TryQuery(sessionId string) (err error) {
	logInClient := partner.NewSoap(queryURL, true, &partner.BasicAuth{username, password + token})

	query := new(partner.Query)

	query.QueryString = "SELECT Id, Name FROM User WHERE Name = 'Sean Healy'"

	//fmt.Println(sessionId)

	resp, err := logInClient.Query(query, sessionId)

	// returns panic error- missing session id in headers- should try to hand sessionid over
	if err != nil {
		panic(err)
	}

	//fmt.Println("\n")
	//fmt.Println(resp)
	//fmt.Println("\n")

	fmt.Println(resp)

	return
}