As Berkant comment said, "this means that the installed CA where your app is running could not confirm the certificate".
The best is check if the certificate of your host is valid and properly configured. If your host use your own certificate, the best is to add it to knows certificates of your system/envinronment. You can also add it to golang itself, or ignore it.
To add your own certificate to golang, see this answer:
How to send a https request with a certificate golang
Then set the client like below:
To ignore it, gosoap.Client has Client field allowing set http.Client, but only after calling gosoap.SoapClient, so you need to mimic gosoap.SoapClient:
func SoapClient(wsdl string) (*gosoap.Client, error) {
_, err := url.Parse(wsdl)
if err != nil {
return nil, err
}
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify : true},
}
//client := &http.Client{Transport: tr}//1: if you wanna add only soap headers
client := &http.Client{Transport: NewAddHeaderTransport(tr)}//1: if you wanna add http headers
//2: if you wann add soap headers, soap.Client has HeaderName and HeaderParams field
soapClient := &gosoap.Client{
HttpClient: client,
WSDL: wsdl,
URL: strings.TrimSuffix(d.TargetNamespace, "/"),
}
err := getWsdlDefinitions(wsdl, &soapClient.Definitions, client)
if err != nil {
return nil, err
}
return soapClient, nil
}
//we use interface{} since gosoap.wsdlDefinitions is unexported
func getWsdlDefinitions(u string, wsdl interface{}, client *http.Client) (err error) {
r, err := client.Get(u)
if err != nil {
return err
}
defer r.Body.Close()
decoder := xml.NewDecoder(r.Body)
decoder.CharsetReader = charset.NewReaderLabel
return decoder.Decode(wsdl)
}
type AddHeaderTransport struct {
T http.RoundTripper
}
func (adt *AddHeaderTransport) RoundTrip(req *http.Request) (*http.Response, error) {
req.Header.Add("Your-Header", "your header value")
return adt.T.RoundTrip(req)
}
func NewAddHeaderTransport(T http.RoundTripper) *AddHeaderTransport {
if T == nil {
T = http.DefaultTransport
}
return &AddHeaderTransport{T}
}