示例#1
0
文件: client.go 项目: vmware/vic
// NewClient creates and returns a new client wirh the ServiceContent field
// filled in.
func NewClient(ctx context.Context, rt soap.RoundTripper) (*Client, error) {
	serviceContent, err := methods.GetServiceContent(ctx, rt)
	if err != nil {
		return nil, err
	}

	c := Client{
		ServiceContent: serviceContent,
		RoundTripper:   rt,
	}

	// Set client if it happens to be a soap.Client
	if sc, ok := rt.(*soap.Client); ok {
		c.Client = sc
	}

	return &c, nil
}
示例#2
0
func defaultKeepAlive(roundTripper soap.RoundTripper) {
	methods.GetServiceContent(context.Background(), roundTripper)
}