Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

53
Task/SOAP/Go/soap-1.go Normal file
View file

@ -0,0 +1,53 @@
package main
import (
"fmt"
"github.com/tiaguinho/gosoap"
"log"
)
type CheckVatResponse struct {
CountryCode string `xml:"countryCode"`
VatNumber string `xml:"vatNumber"`
RequestDate string `xml:"requestDate"`
Valid string `xml:"valid"`
Name string `xml:"name"`
Address string `xml:"address"`
}
var (
rv CheckVatResponse
)
func check(err error) {
if err != nil {
log.Fatal(err)
}
}
func main() {
// create SOAP client
soap, err := gosoap.SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl")
// map parameter names to values
params := gosoap.Params{
"vatNumber": "6388047V",
"countryCode": "IE",
}
// call 'checkVat' function
err = soap.Call("checkVat", params)
check(err)
// unmarshal response to 'rv'
err = soap.Unmarshal(&rv)
check(err)
// print response
fmt.Println("Country Code : ", rv.CountryCode)
fmt.Println("Vat Number : ", rv.VatNumber)
fmt.Println("Request Date : ", rv.RequestDate)
fmt.Println("Valid : ", rv.Valid)
fmt.Println("Name : ", rv.Name)
fmt.Println("Address : ", rv.Address)
}

7
Task/SOAP/Go/soap-2.go Normal file
View file

@ -0,0 +1,7 @@
import soap
procedure main(A)
soap := SoapClient(A[1] | "http://example.com/soap/wsdl") # Allow override of default
write("soapFunc: ",soap.call("soapFunc"))
write("anotherSoapFunc: ",soap.call("anotherSoapFunc"))
end

20
Task/SOAP/Go/soap-3.go Normal file
View file

@ -0,0 +1,20 @@
import soap
procedure main()
server := SoapServer("http://example.com/soap/wsdl")
server.addService("soapFunc", soapFunc)
server.addService("anotherSoapFunc", anotherSoapFunc)
msg := server.handleRequest()
write(msg)
exit(0)
end
procedure soapFunc(A[])
every (s := " ") ||:= (!A || " ")
return "Hello" || s[1:-1]
end
procedure anotherSoapFunc(A[])
every (s := " ") ||:= (!A || " ")
return "Goodbye" || s[1:-1]
end