soap

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 7 Imported by: 0

README

grid

Documentation

Overview

Package soap provides a SOAP HTTP client.

Index

Constants

View Source
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:soapenv,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 BusClient added in v0.0.5

type BusClient struct {
	BaseURL        string               //URL of the server
	MethodName     string               //method name to call
	Config         *http.Client         //HTTP client
	ContentType    string               //Content-Type (default application/json)
	UserAgent      string               //proxy for client request(default Gin-Grid 1.0.1)
	Host           string               //host
	Accept         string               //default:
	AcceptEncoding string               //defaut:
	AcceptLanguage string               //default:
	CacheControl   string               //cache
	Keepalive      bool                 //default true
	Pre            func(*http.Request)  //hook to modify outbound requests
	Post           func(*http.Response) //hook to snoop inbound responses
}

* Client is a http client.

func (*BusClient) RoundTripWithBus added in v0.0.5

func (c *BusClient) RoundTripWithBus(method string, in []byte) ([]byte, error)

type Client

type Client struct {
	URL                    string               // URL of the server
	Namespace              string               // SOAP 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
	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
}

Client is a SOAP client.

func (*Client) RoundTrip

func (c *Client) RoundTrip(in, out Message) error

RoundTrip implements the RoundTripper interface.

func (*Client) RoundTripSoap12

func (c *Client) RoundTripSoap12(action string, in, out Message) error

RoundTripSoap12 implements the RoundTripper interface for SOAP 1.2.

func (*Client) RoundTripWithAction

func (c *Client) RoundTripWithAction(soapAction string, in, out Message) error

RoundTripWithAction implements the RoundTripper interface for SOAP clients that need to set the SOAPAction header.

type Envelope

type Envelope struct {
	XMLName      xml.Name `xml:"soapenv:Envelope"`
	EnvelopeAttr string   `xml:"xmlns:soapenv,attr"`
	TNSAttr      string   `xml:"xmlns:unif,attr,omitempty"`
	TNSAttr2     string   `xml:"xmlns:ical,attr,omitempty"`
	XSIAttr      string   `xml:"xmlns:xsi,attr,omitempty"`
	Header       Message  `xml:"soapenv:Header"`
	Body         Message  `xml:"soapenv:Body"`
}

Envelope is a SOAP envelope.

type HTTPError

type HTTPError struct {
	StatusCode int
	Status     string
	Msg        string
}

HTTPError is detailed soap http error

func (*HTTPError) Error

func (e *HTTPError) Error() string
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.

type XMLTyper

type XMLTyper interface {
	SetXMLType()
}

XMLTyper is an abstract interface for types that can set an XML type.

Jump to

Keyboard shortcuts

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