mirror of
https://github.com/kerberos-io/onvif.git
synced 2025-10-06 08:16:56 +08:00
23 lines
404 B
Go
23 lines
404 B
Go
package networking
|
|
|
|
import (
|
|
"net/http"
|
|
"bytes"
|
|
"io/ioutil"
|
|
)
|
|
|
|
func SendSoap(endpoint, message string) (string, error) {
|
|
httpClient := new(http.Client)
|
|
|
|
resp, err := httpClient.Post(endpoint, "application/soap+xml; charset=utf-8", bytes.NewBufferString(message))
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
b, err := ioutil.ReadAll(resp.Body)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return string(b),nil
|
|
}
|