Documentation ¶
Index ¶
- func CheckFault(soapResponse []byte) error
- func Request(url string, soapRequest []byte, soapAction string) ([]byte, error)
- func SoapFomMTOM(soap []byte) ([]byte, error)
- type Body
- type Created
- type Envelope
- type Fault
- type Header
- type Nonce
- type Password
- type ResponseBody
- type ResponseEnvelope
- type Username
- type UsernameToken
- type WsseSecurity
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFault ¶
func SoapFomMTOM ¶
Example ¶
s := []byte("dasdasd---dasdad<><soap:envelope>adsdasfasdfsadfsaf<adsfas><asdfasdf></soap:envelope>--sadadad<>asdasd") out, _ := SoapFomMTOM(s) os.Stdout.Write(out)
Output: <soap:envelope>adsdasfasdfsadfsaf<adsfas><asdfasdf></soap:envelope>
Types ¶
type Body ¶
Example ¶
env := &Envelope{ XmlnsSoapenv: "http://schemas.xmlsoap.org/soap/envelope/", } env.Body = &Body{} output, err := xml.MarshalIndent(env, prefix, indent) if err != nil { fmt.Printf("error: %v\n", err) } os.Stdout.Write(output)
Output: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:univ="http://www.example.pl/ws/test/universal"> <soapenv:Body></soapenv:Body> </soapenv:Envelope>
type Created ¶
type Created struct { XMLName xml.Name `xml:"wsu:Created,omitempty"` Value string `xml:",chardata"` }
Example ¶
env := &Envelope{ XmlnsSoapenv: "http://schemas.xmlsoap.org/soap/envelope/", Header: &Header{ WsseSecurity: &WsseSecurity{ MustUnderstand: "1", XmlnsWsse: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", XmlnsWsu: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", UsernameToken: &UsernameToken{ WsuId: "UsernameToken-1", Username: &Username{}, Password: &Password{ Type: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText", }, Nonce: &Nonce{ EncodingType: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary", }, Created: &Created{}, }, }, }, } env.Header.WsseSecurity.UsernameToken.Username.Value = "test" env.Header.WsseSecurity.UsernameToken.Password.Value = "pass" env.Header.WsseSecurity.UsernameToken.Nonce.Value = "nvKKZ20LNP8wpCa4vAeQhQ==" env.Header.WsseSecurity.UsernameToken.Created.Value = "2015-09-10T12:25:55.121Z" output, err := xml.MarshalIndent(env, prefix, indent) if err != nil { fmt.Printf("error: %v\n", err) } os.Stdout.Write(output)
Output: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:univ="http://www.example.pl/ws/test/universal"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:UsernameToken wsu:Id="UsernameToken-1"> <wsse:Username>test</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">pass</wsse:Password> <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">nvKKZ20LNP8wpCa4vAeQhQ==</wsse:Nonce> <wsu:Created>2015-09-10T12:25:55.121Z</wsu:Created> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> </soapenv:Envelope>
type Envelope ¶
type Envelope struct { XMLName xml.Name `xml:"soapenv:Envelope"` XmlnsSoapenv string `xml:"xmlns:soapenv,attr"` XmlnsPojo string `xml:"xmlns:pojo,attr"` Header *Header Body *Body }
Example ¶
env := &Envelope{ XmlnsSoapenv: "http://schemas.xmlsoap.org/soap/envelope/", XmlnsUniv: namespaceUniv, } output, err := xml.MarshalIndent(env, prefix, indent) if err != nil { fmt.Printf("error: %v\n", err) } os.Stdout.Write(output)
Output: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:univ="http://www.example.pl/ws/test/universal"></soapenv:Envelope>
type Header ¶
type Header struct { XMLName xml.Name `xml:"soapenv:Header"` WsseSecurity *WsseSecurity }
Example ¶
env := &Envelope{ XmlnsSoapenv: "http://schemas.xmlsoap.org/soap/envelope/", Header: &Header{}, } output, err := xml.MarshalIndent(env, prefix, indent) if err != nil { fmt.Printf("error: %v\n", err) } os.Stdout.Write(output)
Output: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:univ="http://www.example.pl/ws/test/universal"> <soapenv:Header></soapenv:Header> </soapenv:Envelope>
type Nonce ¶
type Nonce struct { XMLName xml.Name `xml:"wsse:Nonce,omitempty"` EncodingType string `xml:"EncodingType,attr,omitempty"` Value string `xml:",chardata"` }
Example ¶
env := &Envelope{ XmlnsSoapenv: "http://schemas.xmlsoap.org/soap/envelope/", Header: &Header{ WsseSecurity: &WsseSecurity{ MustUnderstand: "1", XmlnsWsse: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", XmlnsWsu: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", UsernameToken: &UsernameToken{ WsuId: "UsernameToken-1", Username: &Username{}, Password: &Password{ Type: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText", }, Nonce: &Nonce{ EncodingType: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary", }, }, }, }, } env.Header.WsseSecurity.UsernameToken.Username.Value = "test" env.Header.WsseSecurity.UsernameToken.Password.Value = "pass" env.Header.WsseSecurity.UsernameToken.Nonce.Value = "nvKKZ20LNP8wpCa4vAeQhQ==" output, err := xml.MarshalIndent(env, prefix, indent) if err != nil { fmt.Printf("error: %v\n", err) } os.Stdout.Write(output)
Output: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:univ="http://www.example.pl/ws/test/universal"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:UsernameToken wsu:Id="UsernameToken-1"> <wsse:Username>test</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">pass</wsse:Password> <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">nvKKZ20LNP8wpCa4vAeQhQ==</wsse:Nonce> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> </soapenv:Envelope>
type Password ¶
type Password struct { XMLName xml.Name `xml:"wsse:Password"` Type string `xml:"Type,attr"` Value string `xml:",chardata"` }
Example ¶
env := &Envelope{ XmlnsSoapenv: "http://schemas.xmlsoap.org/soap/envelope/", Header: &Header{ WsseSecurity: &WsseSecurity{ MustUnderstand: "1", XmlnsWsse: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", XmlnsWsu: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", UsernameToken: &UsernameToken{ WsuId: "UsernameToken-1", Password: &Password{ Type: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText", }, }, }, }, } env.Header.WsseSecurity.UsernameToken.Password.Value = "pass" output, err := xml.MarshalIndent(env, prefix, indent) if err != nil { fmt.Printf("error: %v\n", err) } os.Stdout.Write(output)
Output: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:univ="http://www.example.pl/ws/test/universal"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:UsernameToken wsu:Id="UsernameToken-1"> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">pass</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> </soapenv:Envelope>
type ResponseBody ¶
type ResponseEnvelope ¶
type ResponseEnvelope struct { XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"` ResponseBodyBody ResponseBody `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"` }
type Username ¶
Example ¶
env := &Envelope{ XmlnsSoapenv: "http://schemas.xmlsoap.org/soap/envelope/", Header: &Header{ WsseSecurity: &WsseSecurity{ MustUnderstand: "1", XmlnsWsse: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", XmlnsWsu: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", UsernameToken: &UsernameToken{ WsuId: "UsernameToken-1", Username: &Username{}, }, }, }, } env.Header.WsseSecurity.UsernameToken.Username.Value = "test" output, err := xml.MarshalIndent(env, prefix, indent) if err != nil { fmt.Printf("error: %v\n", err) } os.Stdout.Write(output)
Output: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:univ="http://www.example.pl/ws/test/universal"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:UsernameToken wsu:Id="UsernameToken-1"> <wsse:Username>test</wsse:Username> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> </soapenv:Envelope>
type UsernameToken ¶
type UsernameToken struct { XMLName xml.Name `xml:"wsse:UsernameToken"` WsuId string `xml:"wsu:Id,attr,omitempty"` Username *Username Password *Password Nonce *Nonce Created *Created }
Example ¶
env := &Envelope{ XmlnsSoapenv: "http://schemas.xmlsoap.org/soap/envelope/", Header: &Header{ WsseSecurity: &WsseSecurity{ MustUnderstand: "1", XmlnsWsse: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", XmlnsWsu: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", UsernameToken: &UsernameToken{ WsuId: "UsernameToken-1", }, }, }, } output, err := xml.MarshalIndent(env, prefix, indent) if err != nil { fmt.Printf("error: %v\n", err) } os.Stdout.Write(output)
Output: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:univ="http://www.example.pl/ws/test/universal"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:UsernameToken wsu:Id="UsernameToken-1"></wsse:UsernameToken> </wsse:Security> </soapenv:Header> </soapenv:Envelope>
type WsseSecurity ¶
type WsseSecurity struct { MustUnderstand string `xml:"soapenv:mustUnderstand,attr"` XMLName xml.Name `xml:"wsse:Security"` XmlnsWsse string `xml:"xmlns:wsse,attr"` XmlnsWsu string `xml:"xmlns:wsu,attr"` UsernameToken *UsernameToken }
Example ¶
env := &Envelope{ XmlnsSoapenv: "http://schemas.xmlsoap.org/soap/envelope/", Header: &Header{ WsseSecurity: &WsseSecurity{ MustUnderstand: "1", XmlnsWsse: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", XmlnsWsu: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", }, }, } output, err := xml.MarshalIndent(env, prefix, indent) if err != nil { fmt.Printf("error: %v\n", err) } os.Stdout.Write(output)
Output: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:univ="http://www.example.pl/ws/test/universal"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"></wsse:Security> </soapenv:Header> </soapenv:Envelope>
Click to show internal directories.
Click to hide internal directories.