tiaguinho/gosoap

Cannot show the result

Opened this issue · 0 comments

http://www.dneonline.com/calculator.asmx?WSDL
The example WSDL is find an internet,
Here is my code

when I try to run the code

always receive ERRO[0000] {{0}}

I want to know is the file cannot read the WSDL file or something wrong?

Thanks

package main

import (
	"github.com/tiaguinho/gosoap"
	"fmt"
	"github.com/sirupsen/logrus"
)

type GetAddResult struct {
	AddResult int
}

type GetAddResponse struct {
	GetAddRs GetAddResult
}


var (
	r GetAddResponse
)

func main() {
	soap, err := gosoap.SoapClient("http://www.dneonline.com/calculator.asmx?WSDL")
	if err != nil {
		logrus.Error("err")
		fmt.Errorf("error not expected: %s", err)
	}

	params := gosoap.Params{
		"intA": "1",
		"intB": "1",
	}

	fmt.Print(soap)

	err = soap.Call("Add", params)
	if err != nil {
		logrus.Error("err1")
		fmt.Errorf("error in soap call: %s", err)
		return;
	}

fmt.Print(soap.Unmarshal(&r))

	soap.Unmarshal(&r)
	fmt.Print("\n\n")
	if r.GetAddRs.AddResult != 2 {
		logrus.Error(r)
		// fmt.Errorf("error: %+v", r)
	} else {
		logrus.Info("else")
	}
}