Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么一直提示 TOKEN 不存在啊 #53

Open
fclampqq opened this issue Nov 15, 2024 · 0 comments
Open

为什么一直提示 TOKEN 不存在啊 #53

fclampqq opened this issue Nov 15, 2024 · 0 comments

Comments

@fclampqq
Copy link

我如用下代码实现 PTZ,

devhand, err7 := goonvif.NewDevice(
	goonvif.DeviceParams{
		Xaddr:    ip,
		Username: uname,
		Password: pwd,
	})

var ProfileToken onvif.ReferenceToken
ProfileToken = "PtzToken_1"

move := ptz.RelativeMove{
	ProfileToken: ProfileToken,
	Translation: onvif.PTZVector{ //相对移动的距离
		PanTilt: onvif.Vector2D{ //平移和倾斜的相对距离
			X:     -1.0, //水平方向的相对距离
			Y:     0,    //垂直方向的相对距离
			Space: xsd.AnyURI(anyuri),
		},
		/*
			Zoom: onvif.Vector1D{ //缩放的相对距离
				X:     -1.0, //缩放的相对距离
				Space: xsd.AnyURI(anyuri),
			},*/

	},
	Speed: onvif.PTZSpeed{ //移动的速度
		PanTilt: onvif.Vector2D{
			X:     1, //水平方向的速度
			Y:     1, //垂直方向的速度
			Space: xsd.AnyURI(anyuri),
		},
		/*
			Zoom: onvif.Vector1D{
				X:     1, //缩放的速度
				Space: xsd.AnyURI(anyuri),
			},*/
	},
}

res, err := devhand.CallMethod(move)

但是一直报PtzToken_1 does not exist,

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsadis="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsrp="http://schemas.xmlsoap.org/rp/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap12="http://tempuri.org/soap12.xsd" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tnsn="http://www.eventextension.com/2011/event/topics" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:dndl="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:dnrd="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:dn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tevcp="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding" xmlns:teve="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:tevnc="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:tevnp="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:tevp="http://www.onvif.org/ver10/events/wsdl/PullPointBinding" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:tevps="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:tevpsm="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tevsm="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:timg10="http://www.onvif.org/ver10/imaging/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tptz10="http://www.onvif.org/ver10/ptz/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl">SOAP-ENV:BodySOAP-ENV:FaultSOAP-ENV:CodeSOAP-ENV:ValueSOAP-ENV:Sender</SOAP-ENV:Value>SOAP-ENV:SubcodeSOAP-ENV:Valueter:InvalidArgVal</SOAP-ENV:Value>SOAP-ENV:SubcodeSOAP-ENV:Valueter:NoProfile</SOAP-ENV:Value></SOAP-ENV:Subcode></SOAP-ENV:Subcode></SOAP-ENV:Code>SOAP-ENV:Reason<SOAP-ENV:Text xml:lang="en">Profile token does not exist</SOAP-ENV:Text></SOAP-ENV:Reason>SOAP-ENV:DetailSOAP-ENV:TextThe requested profile token PtzToken_1 does not exist</SOAP-ENV:Text></SOAP-ENV:Detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

但我用 rs7 := ptz.GetConfigurations{} rs2, err3 := devhand.CallMethod(rs7) 我查询了XML返回 是有 PtzToken_1
为什么报没有呐?

<SOAP-ENV:Body>
    <tptz:GetConfigurationsResponse>
        <tptz:PTZConfiguration token="PtzToken_1">
            <tt:Name>PtzConfig_1</tt:Name>
            <tt:UseCount>3</tt:UseCount>
            <tt:NodeToken>PtzNodeToken_1</tt:NodeToken>
            <tt:DefaultAbsolutePantTiltPositionSpace>http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace</tt:DefaultAbsolutePantTiltPositionSpace>
            <tt:DefaultAbsoluteZoomPositionSpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace</tt:DefaultAbsoluteZoomPositionSpace>
            <tt:DefaultRelativePanTiltTranslationSpace>http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationGenericSpace</tt:DefaultRelativePanTiltTranslationSpace>
            <tt:DefaultRelativeZoomTranslationSpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/TranslationGenericSpace</tt:DefaultRelativeZoomTranslationSpace>
            <tt:DefaultContinuousPanTiltVelocitySpace>http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace</tt:DefaultContinuousPanTiltVelocitySpace>
            <tt:DefaultContinuousZoomVelocitySpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace</tt:DefaultContinuousZoomVelocitySpace>
            <tt:DefaultPTZSpeed>
                <tt:PanTilt x="1" y="1" space="http://www.onvif.org/ver10/tptz/PanTiltSpaces/GenericSpeedSpace"></tt:PanTilt>
                <tt:Zoom x="1" space="http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace"></tt:Zoom>
            </tt:DefaultPTZSpeed>
            <tt:DefaultPTZTimeout>PT60S</tt:DefaultPTZTimeout>
            <tt:PanTiltLimits>
                <tt:Range>
                    <tt:URI>http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace</tt:URI>
                    <tt:XRange>
                        <tt:Min>-INF</tt:Min>
                        <tt:Max>INF</tt:Max>
                    </tt:XRange>
                    <tt:YRange>
                        <tt:Min>-INF</tt:Min>
                        <tt:Max>INF</tt:Max>
                    </tt:YRange>
                </tt:Range>
            </tt:PanTiltLimits>
            <tt:ZoomLimits>
                <tt:Range>
                    <tt:URI>http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace</tt:URI>
                    <tt:XRange>
                        <tt:Min>-INF</tt:Min>
                        <tt:Max>INF</tt:Max>
                    </tt:XRange>
                </tt:Range>
            </tt:ZoomLimits>
        </tptz:PTZConfiguration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant