Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Ido Shlomo

+ Follow
since Apr 17, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ido Shlomo

I think that the problem is in the fake service we added to the wsdl
It should be soap12:address instead of soap:address
5 years ago
You might need to find a different version of the wsdl file. You used soap 1.2 and the device requires you to use soap 1.1
5 years ago
Yeah, I've cleaned it up and reposted this solution on stack overflow

It looks that either the device you're communicating with returns the wrong class, or that it tries to return an error.
I'd suggest using wireshark to read the traffic directly and look at the xml that you end up sending and the xml you receive back from the device.
It's usually readable enough to help you understand what went wrong.
5 years ago
By the username, I'm guessing that you are using an axis camera.
You need to create a user specific for ONVIF in the cameras web interface.

You should also try to read the camera's current time, and use that for authentication instead of your local time.
See my example above
6 years ago
1. Is your clock synchronized with the device you're trying to connect to?

2. I've tried using the nonce you've posted and got the following results:

nonce str: 1234567892133613
time str: 1970-01-11T21:39:42.208Z
pass str: 123456

In bytes:
nonce bytes: [49, 50, 51, 52, 53, 54, 55, 56, 57, 50, 49, 51, 51, 54, 49, 51]
time bytes: [49, 57, 55, 48, 45, 48, 49, 45, 49, 49, 84, 50, 49, 58, 51, 57, 58, 52, 50, 46, 50, 48, 56, 90]
pass bytes: [49, 50, 51, 52, 53, 54]

digest str: TiWxOU9wmwlMQlIx3a856HpQYAk=
digest bytes: [84, 105, 87, 120, 79, 85, 57, 119, 109, 119, 108, 77, 81, 108, 73, 120, 51, 97, 56, 53, 54, 72, 112, 81, 89, 65, 107, 61]

Please make sure you get the same result when using this exact input.
6 years ago
nonce is an array of 16 bytes, not an int.
the byte[16] none may contain zeros, so use memcpy, instead of sprintf
6 years ago
Looks like I forgot to add the implementation of the message digest creation:

6 years ago
An important thing I've discovered about Axis cameras:
Once you set the initial root password using the web interface, the ONVIF interface will not allow access.
You must reset the camera to its factory defaults in order to use the ONVIF interface without credentials.
You should now be able to initialize the root password and ONVIF passwords via the ONVIF interface.
If you did, however initialize the camera's root password via the web interface, you should also manually add an ONVIF user as explained above.
I would like to thank this blessed behavior for wasting my time.
6 years ago
I finally solved it:

Start off by browsing into the Axis camera's web interface:

Open your browser
Open the Axis camera's web interface
Go to Setup -> System Options -> Security -> ONVIF
Add a user!

Now for the code part.
You start off by reading the server's clock:

Then, you create an authentication header.
For that you need to bind a handler:

Implement the handler

And there you have it.
6 years ago
You were so close!
After banging my head with this for a few days I finally found the fix!

It works for devices that don't require authentication. I'm still stuck with authenticating when needed.
6 years ago