mirror of
https://github.com/kerberos-io/onvif.git
synced 2025-10-06 16:27:05 +08:00
29 lines
672 B
Go
29 lines
672 B
Go
package networking
|
|
|
|
import (
|
|
"net/http"
|
|
"bytes"
|
|
)
|
|
|
|
func SendSoap(endpoint, message string) (*http.Response, error) {
|
|
httpClient := new(http.Client)
|
|
|
|
resp, err := httpClient.Post(endpoint, "application/soap+xml; charset=utf-8", bytes.NewBufferString(message))
|
|
if err != nil {
|
|
return resp, err
|
|
}
|
|
|
|
/*if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusBadRequest {
|
|
return "", errors.New("error: got HTTP response status " + strconv.Itoa(resp.StatusCode))
|
|
}*/
|
|
//b, err := ioutil.ReadAll(resp.Body)
|
|
//if err != nil {
|
|
// return resp, err
|
|
//}
|
|
//fmt.Println(endpoint)
|
|
//fmt.Println(string(b))
|
|
//log.Println(resp.StatusCode)
|
|
|
|
return resp,nil
|
|
}
|