forked from radoslav/soap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_test.go
More file actions
47 lines (39 loc) · 1.07 KB
/
client_test.go
File metadata and controls
47 lines (39 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package soap
import (
"os"
)
func ExampleSoapFomMTOM() {
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>
}
func ExampleSoapFomMTOM2() {
s := `
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset="utf-8"
X-Backside-Transport: FAIL FAIL
Connection: close
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<env:Fault>
<faultcode>env:Client</faultcode>
<faultstring>Rejected (from client)</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
<><>
`
out, _ := SoapFomMTOM([]byte(s))
os.Stdout.Write(out)
// Output:
// <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
// <env:Body>
// <env:Fault>
// <faultcode>env:Client</faultcode>
// <faultstring>Rejected (from client)</faultstring>
// </env:Fault>
// </env:Body>
// </env:Envelope>
}