forked from hooklift/gowsdl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.go
35 lines (31 loc) · 820 Bytes
/
example.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package example
import (
"crypto/tls"
"log"
"time"
"github.com/canerc/gowsdl/example/gen"
"github.com/canerc/gowsdl/soap"
)
func ExampleBasicUsage() {
client := soap.NewClient("http://svc.asmx")
service := gen.NewStockQuotePortType(client)
reply, err := service.GetLastTradePrice(&gen.TradePriceRequest{})
if err != nil {
log.Fatalf("could't get trade prices: %v", err)
}
log.Println(reply)
}
func ExampleWithOptions() {
client := soap.NewClient(
"http://svc.asmx",
soap.WithTimeout(time.Second*5),
soap.WithBasicAuth("usr", "psw"),
soap.WithTLS(&tls.Config{InsecureSkipVerify: true}),
)
service := gen.NewStockQuotePortType(client)
reply, err := service.GetLastTradePrice(&gen.TradePriceRequest{})
if err != nil {
log.Fatalf("could't get trade prices: %v", err)
}
log.Println(reply)
}