Documentation
¶
Overview ¶
Package client provides a SOAP client for invoking SOAP web services. It handles XML envelope creation, SOAP action headers, and response parsing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a SOAP client that wraps an httpcli.Client for making SOAP requests.
func (Client) Invoke ¶
func (c Client) Invoke( ctx context.Context, url string, soapAction string, extraHeaders map[string]string, requestBody any, ) (*Response, error)
Invoke sends a SOAP request to the specified URL with the given action and headers. It automatically wraps the request body in a SOAP envelope and parses the response. Returns a Response object for parsing the SOAP response or fault.
type PlainXml ¶
type PlainXml struct {
Value []byte `xml:",innerxml"`
}
PlainXml represents raw XML content for SOAP requests or responses. It is used when the SOAP body contains non-structured XML data. The Value field captures the inner XML without envelope wrapping.
type Response ¶
Response represents a SOAP response received from a web service. It provides methods for parsing the response payload and checking for faults.
func (*Response) Fault ¶
Fault checks if the response contains a SOAP fault and returns it. It returns nil if no fault is present. Returns an error if the response body cannot be read or decoded.
func (*Response) UnmarshalPayload ¶
UnmarshalPayload decodes the SOAP response body into the provided struct. It handles both standard SOAP envelopes and raw XML (PlainXml) responses. Returns an error if the response body cannot be read or decoded.