Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.
/ soap Public archive

The Go Client for SOAP

License

Notifications You must be signed in to change notification settings

itcomusic/soap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SOAP Go Client

Install

go get -u github.com/itcomusic/soap

Usage

package main

import (
	"context"
	"crypto/tls"
	"encoding/xml"
	"log"

	"github.com/itcomusic/soap"
)

// <urn:ExampleRequest xmlns:urn="something">
//    <Attr>Go</Attr>
// </urn:ExampleRequest>

type Request struct {
	XMLName xml.Name `xml:"urn:ExampleRequest"`
	XmlNS   string   `xml:"xmlns:urn,attr"`
	Attr    string   `xml:"Attr"`
}

func main() {
	c := soap.NewClient("http://127.0.0.1/call", soap.Config{
		BasicAuth: &soap.BasicAuth{
			Username: "test",
			Password: "test",
		},
		TLS: &tls.Config{InsecureSkipVerify: true}})
	
    ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
    defer cancel()
	if err := c.Call(ctx, "", Request{
		XmlNS: "something",
		Attr:  "Go",
	}, nil); err != nil {
		log.Fatal(err)
	}
}

About

The Go Client for SOAP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages