Documentation ¶
Overview ¶
Package soap provides a SOAP HTTP client.
Index ¶
- Constants
- type AuthHeader
- type Client
- func (c *Client) RoundTrip(in, out Message) error
- func (c *Client) RoundTripSoap12(action string, in, out Message) error
- func (c *Client) RoundTripWithAction(soapAction string, in, out Message) error
- func (c *Client) RoundTripWithActionAndCustomHeaders(soapAction string, headers CustomHeaders, in, out Message) error
- type CustomHeaders
- type Envelope
- type FaultError
- type FaultMessageHandler
- type HTTPError
- type Header
- type Message
- type RoundTripper
- type XMLTyper
Constants ¶
const XSINamespace = "http://www.w3.org/2001/XMLSchema-instance"
XSINamespace is a link to the XML Schema instance namespace.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthHeader ¶
type AuthHeader struct { Namespace string `xml:"xmlns:ns,attr"` Username string `xml:"ns:username"` Password string `xml:"ns:password"` }
AuthHeader is a Header to be encoded as the SOAP Header element in requests, to convey credentials for authentication.
type Client ¶
type Client struct { URL string // URL of the server UserAgent string // User-Agent header will be added to each request Namespace string // SOAP Namespace URNamespace string // Uniform Resource Namespace ThisNamespace string // SOAP This-Namespace (tns) ExcludeActionNamespace bool // Include Namespace to SOAP Action header Envelope string // Optional SOAP Envelope Header Header // Optional SOAP Header FaultMessageHandler FaultMessageHandler // Optional Fault message handler ContentType string // Optional Content-Type (default text/xml) Config *http.Client // Optional HTTP client Pre func(*http.Request) // Optional hook to modify outbound requests Post func(*http.Response) // Optional hook to snoop inbound responses Ctx context.Context // Optional variable to allow Context Tracking. }
Client is a SOAP client.
func (*Client) RoundTripSoap12 ¶ added in v1.4.6
RoundTripSoap12 implements the RoundTripper interface for SOAP 1.2.
func (*Client) RoundTripWithAction ¶ added in v1.4.6
RoundTripWithAction implements the RoundTripper interface for SOAP clients that need to set the SOAPAction header.
func (*Client) RoundTripWithActionAndCustomHeaders ¶ added in v1.4.8
func (c *Client) RoundTripWithActionAndCustomHeaders(soapAction string, headers CustomHeaders, in, out Message) error
RoundTripWithAction implements the RoundTripper interface for SOAP clients that need to set the SOAPAction header and custom auth.
type CustomHeaders ¶ added in v1.4.8
Auth contains customs parameters that has to be passed to request headers
type Envelope ¶
type Envelope struct { XMLName xml.Name `xml:"SOAP-ENV:Envelope"` EnvelopeAttr string `xml:"xmlns:SOAP-ENV,attr"` NSAttr string `xml:"xmlns:ns,attr"` TNSAttr string `xml:"xmlns:tns,attr,omitempty"` URNAttr string `xml:"xmlns:urn,attr,omitempty"` XSIAttr string `xml:"xmlns:xsi,attr,omitempty"` Header Message `xml:"SOAP-ENV:Header"` Body Message `xml:"SOAP-ENV:Body"` }
Envelope is a SOAP envelope.
type FaultError ¶ added in v1.4.8
FaultError is detailed soap http error
func (*FaultError) Error ¶ added in v1.4.8
func (e *FaultError) Error() string
type FaultMessageHandler ¶ added in v1.4.8
type Header ¶
type Header interface{}
Header is an opaque type used as the SOAP Header element in requests.
type Message ¶
type Message interface{}
Message is an opaque type used by the RoundTripper to carry XML documents for SOAP.
type RoundTripper ¶
type RoundTripper interface { RoundTrip(req, resp Message) error RoundTripSoap12(action string, req, resp Message) error }
A RoundTripper executes a request passing the given req as the SOAP envelope body. The HTTP response is then de-serialized onto the resp object. Returns error in case an error occurs serializing req, making the HTTP request, or de-serializing the response.