Documentation ¶
Index ¶
- Constants
- Variables
- func LogXml(logType string, message interface{})
- func String(v string) *string
- type Binary
- func (b *Binary) Bytes() []byte
- func (b *Binary) ContentType() string
- func (b *Binary) MarshalXML(enc *xml.Encoder, start xml.StartElement) error
- func (b *Binary) SetContentType(contentType string) *Binary
- func (b *Binary) SetPackageID(packageID string) *Binary
- func (b *Binary) SetUseMTOM(useMTOM bool) *Binary
- func (b *Binary) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Client
- func (s *Client) AddHeader(header interface{})
- func (s *Client) AddMIMEMultipartAttachment(attachment soap.MIMEMultipartAttachment)
- func (s *Client) Call(soapAction string, request, response interface{}) error
- func (s *Client) CallContext(ctx context.Context, soapAction string, request, response interface{}) error
- func (s *Client) CallContextWithAttachmentsAndFaultDetail(ctx context.Context, soapAction string, request, response interface{}, ...) error
- func (s *Client) CallContextWithFaultDetail(ctx context.Context, soapAction string, request, response interface{}, ...) error
- func (s *Client) CallWithFaultDetail(soapAction string, request, response interface{}, faultDetail soap.FaultError) error
- func (s *Client) SetHeaders(headers ...interface{})
- type Credential
- type DomainCredential
- type HTTPClient
- type Option
- func WithBasicAuth(credential *Credential) Option
- func WithHTTPClient(c *http.Client) Option
- func WithHTTPHeaders(headers map[string]string) Option
- func WithLogRequests(on bool) Option
- func WithLogResponses(on bool) Option
- func WithMIMEMultipartAttachments() Option
- func WithMTOM() Option
- func WithNTLM(credential *DomainCredential) Option
- func WithRequestTimeout(t time.Duration) Option
- func WithTLS(tls *tls.Config) Option
- func WithTLSHandshakeTimeout(t time.Duration) Option
- func WithTimeout(t time.Duration) Option
- type Options
- type WSSPassword
- type WSSSecurityHeader
- type WSSUsername
- type WSSUsernameToken
Constants ¶
const ( 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 ¶
Functions ¶
Types ¶
type Binary ¶
type Binary struct {
// contains filtered or unexported fields
}
Binary enables binary data to be enchanged in MTOM mode with XOP encoding When MTOM is not used, the field is encoded in Base64
func NewBinary ¶
NewBinary allocate a new Binary backed by the given byte slice, an auto-generated packageID and no MTOM-usage
func (*Binary) ContentType ¶
ContentType returns the content type
func (*Binary) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface to encode a Binary to XML
func (*Binary) SetContentType ¶
SetContentType sets the content type the content will be transmitted as multipart
func (*Binary) SetPackageID ¶
SetPackageID sets and overrides the default auto-generated package ID to be used for the multipart binary
func (*Binary) SetUseMTOM ¶
SetUseMTOM activates the XOP transformation of binaries in MTOM requests
func (*Binary) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface to decode a Binary form XML
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client - soap client
func (*Client) AddHeader ¶
func (s *Client) AddHeader(header interface{})
AddHeader adds envelope header For correct behavior, every header must contain a `XMLName` field. Refer to #121 for details
func (*Client) AddMIMEMultipartAttachment ¶
func (s *Client) AddMIMEMultipartAttachment(attachment soap.MIMEMultipartAttachment)
AddMIMEMultipartAttachment adds an attachment to the client that will be sent only if the WithMIMEMultipartAttachments option is used
func (*Client) Call ¶
Call performs HTTP POST request. Note that if the server returns a status code >= 400, a HTTPError will be returned
func (*Client) CallContext ¶
func (s *Client) CallContext(ctx context.Context, soapAction string, request, response interface{}) error
CallContext performs HTTP POST request with a context
func (*Client) CallContextWithAttachmentsAndFaultDetail ¶
func (s *Client) CallContextWithAttachmentsAndFaultDetail(ctx context.Context, soapAction string, request, response interface{}, faultDetail soap.FaultError, attachments *[]soap.MIMEMultipartAttachment) error
CallContextWithAttachmentsAndFaultDetail performs HTTP POST request. Note that if SOAP fault is returned, it will be stored in the error. On top the attachments array will be filled with attachments returned from the SOAP request.
func (*Client) CallContextWithFaultDetail ¶
func (s *Client) CallContextWithFaultDetail(ctx context.Context, soapAction string, request, response interface{}, faultDetail soap.FaultError) error
CallContextWithFaultDetail performs HTTP POST request. Note that if SOAP fault is returned, it will be stored in the error.
func (*Client) CallWithFaultDetail ¶
func (s *Client) CallWithFaultDetail(soapAction string, request, response interface{}, faultDetail soap.FaultError) error
CallWithFaultDetail performs HTTP POST request. Note that if SOAP fault is returned, it will be stored in the error. the passed in fault detail is expected to implement FaultError interface, which allows to condense the detail into a short error message.
func (*Client) SetHeaders ¶
func (s *Client) SetHeaders(headers ...interface{})
SetHeaders sets envelope headers, overwriting any existing headers. For correct behavior, every header must contain a `XMLName` field. Refer to #121 for details
type Credential ¶
Credential are used when setting WithBasicAuth or WithNTLM, the latter needs the domain to be set, whereas for basic auth is not needed.
type DomainCredential ¶
type DomainCredential struct { Domain string Credential }
type HTTPClient ¶
HTTPClient is a client which can make HTTP requests
type Option ¶
type Option func(*Options)
Option allows to customize the default http client or even provide a custom http client.
func WithBasicAuth ¶
func WithBasicAuth(credential *Credential) Option
WithBasicAuth is an Option to set BasicAuth
func WithHTTPClient ¶
WithHTTPClient allows to use a custom HTTP client instead of the default.
WithNTLM option, if provided, will replace the http client transport.
WithTLSHandshakeTimeout, WithTLS and/or WithTimeout clientOption will be discarded.
func WithHTTPHeaders ¶
WithHTTPHeaders is an Option to set global HTTP headers for all requests
func WithLogRequests ¶ added in v1.2.0
WithLogRequests sets logging of requests, by default log is disabled
func WithLogResponses ¶ added in v1.2.0
WithLogResponses sets logging of responses, by default log is disabled
func WithMIMEMultipartAttachments ¶
func WithMIMEMultipartAttachments() Option
WithMIMEMultipartAttachments is an Option to set SOAP MIME Multipart attachment support.
Use Client.AddMIMEMultipartAttachment to add attachments of type MIMEMultipartAttachment to your SOAP request.
func WithMTOM ¶
func WithMTOM() Option
WithMTOM is an Option to set Message Transmission Optimization Mechanism. MTOM encodes fields of type Binary using XOP.
func WithNTLM ¶
func WithNTLM(credential *DomainCredential) Option
WithNTLM configures for a given http.Client its transport for NTLM, it works with WithTLS which should be called prior to it to set the right tls.Config, if not it will default to a simple tls.Config with InsecureSkipVerify set to true to avoid certs issues This setting will be configured even in the custom httpClient replacing existing transport with this one.
func WithRequestTimeout ¶
WithRequestTimeout is an Option to set default end-end connection timeout.
This option cannot be used with WithHTTPClient
func WithTLS ¶
WithTLS is an Option to set tls config This option cannot be used with WithHTTPClient
func WithTLSHandshakeTimeout ¶
WithTLSHandshakeTimeout is an Option to set default tls handshake timeout.
This option cannot be used with WithHTTPClient.
func WithTimeout ¶
WithTimeout is an Option to set default HTTP dial context timeout.
type Options ¶
type Options struct { Client HTTPClient Transport *httpntlm.NtlmTransport TlsConfig *tls.Config HttpHeaders map[string]string Mtom bool Mma bool Timeout time.Duration ConnectionTimeout time.Duration TlsHandshakeTimeout time.Duration BasicAuth *Credential NtlmAuth *DomainCredential LogRequests bool LogResponses bool }
type WSSPassword ¶
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(credential *Credential, tokenID, mustUnderstand string) *WSSSecurityHeader
NewWSSSecurityHeader creates WSSSecurityHeader instance
type WSSUsername ¶
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"` }
Source Files ¶
- basic-auth-option.go
- client.go
- credential.go
- http-client-option.go
- http-headers-option.go
- log-requests-option.go
- log-responses-option.go
- mime-multipart-attachment-option.go
- mma-decoder.go
- mma-encoder.go
- mtom-decoder.go
- mtom-encoder.go
- mtom-option.go
- ntlm-option.go
- option.go
- request-timeout-option.go
- timeout-option.go
- tls-handshake-option.go
- tls-option.go
- wss-security-header.go