soap

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2020 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Predefined WSS namespaces to be used in
	WssNsWSSE string = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
	WssNsWSU  string = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
	WssNsType string = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is soap client

func NewClient

func NewClient(url string, opt ...Option) *Client

NewClient creates new SOAP client instance

func (*Client) AddHeader

func (s *Client) AddHeader(header interface{})

AddHeader adds envelope header

func (*Client) Call

func (s *Client) Call(soapAction string, request, response interface{}) error

Call performs HTTP POST request

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is a client which can make HTTP requests An example implementation is net/http.Client

type Option

type Option func(*options)

A Option sets options such as credentials, tls, etc.

func WithBasicAuth

func WithBasicAuth(login, password string) Option

WithBasicAuth is an Option to set BasicAuth

func WithHTTPClient

func WithHTTPClient(c HTTPClient) Option

WithHTTPClient is an Option to set the HTTP client to use This cannot be used with WithTLSHandshakeTimeout, WithTLS, WithTimeout options

func WithHTTPHeaders

func WithHTTPHeaders(headers map[string]string) Option

WithHTTPHeaders is an Option to set global HTTP headers for all requests

func WithRequestTimeout

func WithRequestTimeout(t time.Duration) Option

WithRequestTimeout is an Option to set default end-end connection timeout This option cannot be used with WithHTTPClient

func WithTLS

func WithTLS(tls *tls.Config) Option

WithTLS is an Option to set tls config This option cannot be used with WithHTTPClient

func WithTLSHandshakeTimeout

func WithTLSHandshakeTimeout(t time.Duration) Option

WithTLSHandshakeTimeout is an Option to set default tls handshake timeout This option cannot be used with WithHTTPClient

func WithTimeout

func WithTimeout(t time.Duration) Option

WithTimeout is an Option to set default HTTP dial timeout

type SOAPBody

type SOAPBody struct {
	XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"`

	Fault   *SOAPFault  `xml:",omitempty"`
	Content interface{} `xml:",omitempty"`
}

func (*SOAPBody) UnmarshalXML

func (b *SOAPBody) UnmarshalXML(d *xml.Decoder, _ xml.StartElement) error

UnmarshalXML unmarshals SOAPBody xml

type SOAPEnvelope

type SOAPEnvelope struct {
	XMLName xml.Name      `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"`
	Headers []interface{} `xml:"http://schemas.xmlsoap.org/soap/envelope/ Header"`
	Body    SOAPBody
}

type SOAPFault

type SOAPFault struct {
	XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault"`

	Code   string `xml:"faultcode,omitempty"`
	String string `xml:"faultstring,omitempty"`
	Actor  string `xml:"faultactor,omitempty"`
	Detail string `xml:"detail,omitempty"`
}

func (*SOAPFault) Error

func (f *SOAPFault) Error() string

type WSSPassword

type WSSPassword struct {
	XMLName   xml.Name `xml:"wsse:Password"`
	XmlNSWsse string   `xml:"xmlns:wsse,attr"`
	XmlNSType string   `xml:"Type,attr"`

	Data string `xml:",chardata"`
}

type WSSSecurityHeader

type WSSSecurityHeader struct {
	XMLName   xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ wsse:Security"`
	XmlNSWsse string   `xml:"xmlns:wsse,attr"`

	MustUnderstand string `xml:"mustUnderstand,attr,omitempty"`

	Token *WSSUsernameToken `xml:",omitempty"`
}

func NewWSSSecurityHeader

func NewWSSSecurityHeader(user, pass, tokenID, mustUnderstand string) *WSSSecurityHeader

NewWSSSecurityHeader creates WSSSecurityHeader instance

type WSSUsername

type WSSUsername struct {
	XMLName   xml.Name `xml:"wsse:Username"`
	XmlNSWsse string   `xml:"xmlns:wsse,attr"`

	Data string `xml:",chardata"`
}

type WSSUsernameToken

type WSSUsernameToken struct {
	XMLName   xml.Name `xml:"wsse:UsernameToken"`
	XmlNSWsu  string   `xml:"xmlns:wsu,attr"`
	XmlNSWsse string   `xml:"xmlns:wsse,attr"`

	Id string `xml:"wsu:Id,attr,omitempty"`

	Username *WSSUsername `xml:",omitempty"`
	Password *WSSPassword `xml:",omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL