src.dualinventive.com/go/cp3000-interface/vendor/github.com/tiaguinho/gosoap
Jerry Jacobs 1193c82181 initial 2024-08-09 12:10:16 +02:00
..
.travis.yml initial 2024-08-09 12:10:16 +02:00
LICENSE initial 2024-08-09 12:10:16 +02:00
README.md initial 2024-08-09 12:10:16 +02:00
encode.go initial 2024-08-09 12:10:16 +02:00
go.mod initial 2024-08-09 12:10:16 +02:00
soap.go initial 2024-08-09 12:10:16 +02:00
wsdl.go initial 2024-08-09 12:10:16 +02:00

README.md

Go Soap Build Status GoDoc Go Report Card codecov

package to help with SOAP integrations (client)

Install

go get github.com/tiaguinho/gosoap

Example

package main

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

type GetGeoIPResponse struct {
	GetGeoIPResult GetGeoIPResult
}

type GetGeoIPResult struct {
	ReturnCode        string
	IP                string
	ReturnCodeDetails string
	CountryName       string
	CountryCode       string
}

var (
	r GetGeoIPResponse
)

func main() {
	soap, err := gosoap.SoapClient("http://www.webservicex.net/geoipservice.asmx?WSDL")
	if err != nil {
		fmt.Errorf("error not expected: %s", err)
	}

	params := gosoap.Params{
		"IPAddress": "8.8.8.8",
	}

	err = soap.Call("GetGeoIP", params)
	if err != nil {
		fmt.Errorf("error in soap call: %s", err)
	}

	soap.Unmarshal(&r)
	if r.GetGeoIPResult.CountryCode != "USA" {
		fmt.Errorf("error: %+v", r)
	}
}