mirror of
https://github.com/kerberos-io/onvif.git
synced 2025-10-14 03:53:51 +08:00
api: fix bugs
This commit is contained in:
@@ -21,7 +21,6 @@ func RunApi () {
|
|||||||
router.POST("/:service/:method", func(c *gin.Context) {
|
router.POST("/:service/:method", func(c *gin.Context) {
|
||||||
serviceName := c.Param("service")
|
serviceName := c.Param("service")
|
||||||
methodName := c.Param("method")
|
methodName := c.Param("method")
|
||||||
//todo: login, pass, deviceXaddr
|
|
||||||
username := c.GetHeader("username")
|
username := c.GetHeader("username")
|
||||||
pass := c.GetHeader("password")
|
pass := c.GetHeader("password")
|
||||||
xaddr := c.GetHeader("xaddr")
|
xaddr := c.GetHeader("xaddr")
|
||||||
@@ -227,7 +226,7 @@ func xmlMaker(lst* []interface{}, tags* []map[string]string, lstIndex int) (stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func xmlProcessing (tg string) (string, error) {
|
func xmlProcessing (tg string) (string, error) {
|
||||||
r, _ := regexp.Compile(`\"(.*?)\"`)
|
r, _ := regexp.Compile(`"(.*?)"`)
|
||||||
str := r.FindStringSubmatch(tg)
|
str := r.FindStringSubmatch(tg)
|
||||||
if len(str) == 0 {
|
if len(str) == 0 {
|
||||||
return "", errors.New("out of range")
|
return "", errors.New("out of range")
|
||||||
|
@@ -73,6 +73,8 @@ func GetDeviceStructByName(name string) (interface{}, error) {
|
|||||||
switch name {
|
switch name {
|
||||||
case "CreateUsers":
|
case "CreateUsers":
|
||||||
return &Device.CreateUsers{}, nil
|
return &Device.CreateUsers{}, nil
|
||||||
|
case "GetCapabilities":
|
||||||
|
return &Device.GetCapabilities{}, nil
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("there is no such method in the Device service")
|
return nil, errors.New("there is no such method in the Device service")
|
||||||
}
|
}
|
||||||
|
@@ -14,4 +14,4 @@ func SendSoap(endpoint, message string) (*http.Response, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return resp,nil
|
return resp,nil
|
||||||
}
|
}
|
Reference in New Issue
Block a user