onvif icon indicating copy to clipboard operation
onvif copied to clipboard

CreatePullPointSubscription

Open quonn77 opened this issue 6 years ago • 6 comments

I am playing with your example (WsNotificationTest) about the capability to register to the events generated by the camera. I am was not able to create a pull point subscription, I suppose, for a malformed request. Playing with soapUI I found that using a request like the one generated by the stubs into the library generate an error of type "failed to parse topic expression", If I try to manually change the SOAP request it seems to work. Here follow the two requests:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
	<soap:Header>
		<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustUnderstand="true"><wsse:UsernameToken wsu:Id="UsernameToken-fb13b6a5-d87b-4662-92fd-5b4abefbe264"><wsse:Username>onvifadmin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">e+HhUWCDpzfUdMX4k0b9gwMH3RM=</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">cFSFXKKlQ92SjSxV1LciFA==</wsse:Nonce><wsu:Created>2018-06-11T14:12:32.729Z</wsu:Created></wsse:UsernameToken></wsse:Security>
	</soap:Header>
	<soap:Body>
		<ns2:CreatePullPointSubscription xmlns:ns10="http://www.onvif.org/ver10/device/wsdl" xmlns:ns11="http://www.w3.org/2004/08/xop/include" xmlns:ns12="http://docs.oasis-open.org/wsrf/r-2" xmlns:ns2="http://www.onvif.org/ver10/events/wsdl" xmlns:ns3="http://docs.oasis-open.org/wsn/b-2" xmlns:ns4="http://docs.oasis-open.org/wsn/t-1" xmlns:ns5="http://www.w3.org/2005/08/addressing" xmlns:ns6="http://docs.oasis-open.org/wsrf/bf-2" xmlns:ns7="http://www.onvif.org/ver10/schema" xmlns:ns9="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
			<ns2:Filter><ns3:TopicExpression Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:Device//.</ns3:TopicExpression></ns2:Filter>
			<ns3:InitialTerminationTime>PT10S</ns3:InitialTerminationTime><ns2:SubscriptionPolicy/>
		</ns2:CreatePullPointSubscription>
	</soap:Body>
</soap:Envelope>

This generates a failure:

<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:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:tev1="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:tev2="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:tev3="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev4="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tnsaxis="http://www.axis.com/2009/event/topics" xmlns:ter="http://www.onvif.org/ver10/error">
   <SOAP-ENV:Header>
      <wsa5:To SOAP-ENV:mustUnderstand="true">http://www.w3.org/2005/08/addressing/anonymous</wsa5:To>
      <wsa5:Action SOAP-ENV:mustUnderstand="true">http://www.w3.org/2005/08/addressing/soap/fault</wsa5:Action>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <SOAP-ENV:Code>
            <SOAP-ENV:Value>SOAP-ENV:Sender</SOAP-ENV:Value>
         </SOAP-ENV:Code>
         <SOAP-ENV:Reason>
            <SOAP-ENV:Text xml:lang="en">failed to parse topic expression 'tns1:Device//.'</SOAP-ENV:Text>
         </SOAP-ENV:Reason>
         <SOAP-ENV:Detail>
            <wsnt:InvalidTopicExpressionFault>
               <wsrfbf:Timestamp>2018-06-11T16:15:39Z</wsrfbf:Timestamp>
            </wsnt:InvalidTopicExpressionFault>
         </SOAP-ENV:Detail>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This one instead seems to work:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsdl="http://www.onvif.org/ver10/events/wsdl">
   <soap:Header>
      <wsse:Security soap:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsse:UsernameToken wsu:Id="UsernameToken-595B90767A0CA82C1615284734003533">
            <wsse:Username>onvifadmin</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">rQsU/rVV74SYCLgDlzX3rcAwN+k=</wsse:Password>
            <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">nqmOvRNzRbojZPjBCQUhrA==</wsse:Nonce>
            <wsu:Created>2018-06-08T15:56:40.352Z</wsu:Created>
         </wsse:UsernameToken>
      </wsse:Security>
   </soap:Header>
   <soap:Body>
      <wsdl:CreatePullPointSubscription>
         <!--Optional:-->
         <wsdl:Filter Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:Device//.</wsdl:Filter>
         <!--Optional:-->
         <wsdl:InitialTerminationTime>PT10S</wsdl:InitialTerminationTime>
         <!--Optional:-->
         <wsdl:SubscriptionPolicy>
            <!--You may enter ANY elements at this point-->
         </wsdl:SubscriptionPolicy>
         <!--You may enter ANY elements at this point-->
      </wsdl:CreatePullPointSubscription>
   </soap:Body>
</soap:Envelope>

Have you got any news or idea about it?

I need to read the actual pan and tilt position of the encoder so I am assuming that the events subscription is the proper way to go, but I am not sure of this. Do you have any hints about it?

quonn77 avatar Jun 11 '18 14:06 quonn77

Unfortunately I've got no idea...I migrated the WS to CXF in order to be able to use WS-Notifications but then I dind't find the time to play with it..

fpompermaier avatar Jun 11 '18 14:06 fpompermaier

But do you have some ideas about how to catch the actual pan and tilt position?

quonn77 avatar Jun 11 '18 14:06 quonn77

I think you should first call another ws to ghet those params but I don't know which one

fpompermaier avatar Jun 11 '18 14:06 fpompermaier

Reading here: https://support.videotec.com/hc/en-gb/community/posts/203483685-How-can-I-get-the-current-position-of-an-integrated-PTZ- It seems that the GetStatus could be the command to invoke, but this returns only IDLE or MOVING....So I need to further investigate about it.

quonn77 avatar Jun 11 '18 15:06 quonn77

It's my fault....I have not seen the full response. It answer me the pan, tilt and zoom position. So I have just to convert between spaces

 <tt:PanTilt space="http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace" y="-0.589999974" x="-0.899999976"/>
 <tt:Zoom space="http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace" x="0.727272749"/>

The goal is to create a FOV rendering. So I think I can arrange this kind of service directly inside the onvif library, One could provides a callback/listener to be invoked when data changes. I will work on it next days...

quonn77 avatar Jun 11 '18 16:06 quonn77

Great! :+1:

fpompermaier avatar Jun 12 '18 07:06 fpompermaier