Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ONVIF GetSystemDateAndTime Request

Tags:

onvif

Once I get a response back from the UDP Multicast Request to 239.255.255.250

I get back a ProbeMatch with an XAddrs http://10.10.10.10:1234/onvif/device_service

How do I now do the GetSystemDateAndTime and GetDeviceInformation

Is this a TCP/UDP request to 10.10.10.10 port 1234 ? Is this a HTTP request to 10.10.10.10 port 80 ?

Or What Once I have the device's address http:10.10.10.10:1234/onvif/device_service

Then what

Thanks in advance

like image 376
NewDev Avatar asked Mar 04 '14 23:03

NewDev


People also ask

How to send a getsystemdateandtime request?

You need to send a GetSystemDateAndTime request according to the SOAP protocol. How to send such requests depends on the system you are working on. You may use Visual Studio or gsoap (there's a FAQ about ONVIF)

What is the maximum password length supported by ONVIF devices?

ONVIF compliant devices are recommended to support password length of at least 28 bytes, as clients may follow the password derivation mechanism which results in 'password equivalent' of length 28 bytes, as described in section 3.1.2 of the ONVIF security white paper. Creates new device users and corresponding credentials.

What software do you use to create onvifs?

You may use Visual Studio or gsoap (there's a FAQ about ONVIF) Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.


2 Answers

You need to send there just a HTTP request as SOAP works over HTTP. For example via CURL it would be like this:

curl 10.10.10.10:1234/onvif/device_service -d '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>'

As a result you will get something like this with some headers:

<tds:GetSystemDateAndTimeResponse>
    <tds:SystemDateAndTime>
        <tt:DateTimeType>Manual</tt:DateTimeType>
        <tt:DaylightSavings>false</tt:DaylightSavings>
        <tt:TimeZone>
            <tt:TZ>MoroccoStandardTime0</tt:TZ>
        </tt:TimeZone>
        <tt:UTCDateTime>
            <tt:Time>
                <tt:Hour>10</tt:Hour>
                <tt:Minute>5</tt:Minute>
                <tt:Second>35</tt:Second>
            </tt:Time>
            <tt:Date>
                <tt:Year>2014</tt:Year>
                <tt:Month>3</tt:Month>
                <tt:Day>14</tt:Day>
            </tt:Date>
        </tt:UTCDateTime>
    </tds:SystemDateAndTime>
</tds:GetSystemDateAndTimeResponse>

And also dont forget that most of the actions requires authorization headers included in to the request.

AUTHENTICATION

In ONVIF Application Programmer's Guide on page 35 is described how auth is done. For example it looks like this:

<s:Header>
    <Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <UsernameToken>
            <Username>admin</Username>
            <Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">MuMnyh3wTxGWOCc=</Password>
            <Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">8Qqve9KCkNhQAAAAAAA==</Nonce>
            <Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2014-03-04T14:03:05.130Z</Created>
        </UsernameToken>
    </Security>
</s:Header>
like image 149
Kin Avatar answered Oct 23 '22 01:10

Kin


@Kirix solution didn't work for my particular camera. However, after a huge amount of code study and trail/error.. I determined that the Trendnet camera I have insists on the header being perfect. I figured out a curl variation:

curl http://192.168.xxx.xxx/onvif/device_service --data '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' --header 'Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime";'
like image 44
RoundSparrow hilltx Avatar answered Oct 23 '22 02:10

RoundSparrow hilltx