Hi,
We’re trying to communicate with some of our Axis Cameras, and this time with Xojo.
We have some very basic calls that run perfectly with curl and ruby, but once translated to Xojo, they are not working, and we can’t figure why.
As this cameras are private, I can’t pass the user/psw in case anyone can check the code, but maybe with just the code is enough
Example one, this works in Xojo and Ruby and curl:
[code]curl code:
curl --user user:pass http://2.xxx.xxx.xxx:xxxx/axis-cgi/record/list.cgi?recordingid=all&maxnumberofresults=50
Xojo code:
Dim tt_socket As New HTTPSocket
Dim tt_response As String
Dim tt_query As String
tt_query=“http://2.xxx.xxx.xxx:xxxx/axis-cgi/record/list.cgi?recordingid=all&maxnumberofresults=50”
tt_socket.SetRequestHeader(“Authorization”, “Basic " + EncodeBase64(“user”+”:"+“password”))
tt_response = tt_socket.Get( tt_query, 30 )
MsgBox DefineEncoding(tt_response, Encodings.UTF8)
[/code]
But when we try this other simple call, only works in curl and ruby:
[code]curl code:
curl --user user:pass http://2.xxx.xxx.xxx:xxxx/axis-cgi/param.cgi?action=list&group=Network
Xojo code (the same as before but only change the tt_query:
Dim tt_socket As New HTTPSocket
Dim tt_response As String
Dim tt_query As String
tt_query=“http://2.xxx.xxx.xxx:xxxx/axis-cgi/param.cgi?action=list&group=Network”
tt_socket.SetRequestHeader(“Authorization”, “Basic " + EncodeBase64(“user”+”:"+“password”))
tt_response = tt_socket.Get( tt_query, 30 )
MsgBox DefineEncoding(tt_response, Encodings.UTF8)
[/code]
In this case, the error is 102, the httpStatus code is 200, and we have a blank (empty) response. If we use an invalid user/psw we receive an 'Unauthorized user connection", in that case it’s correct the response.
All tests are with the same ip, same port, same user and same password.
This two calls are ‘almost identical’ …
To add more incongruences to the problem but maybe a hint of why it’s not working, if I issue the call that doesn’t works after the one that works, it correctly works, example:
[code] Dim tt_socket As New HTTPSocket
Dim tt_response As String
Dim tt_query_works, tt_query_no_works As String
tt_query_no_works = “http://2.xxx.xxx.xxx:xxxx/axis-cgi/param.cgi?action=list&group=Network”
tt_query_works=“http://2.xxx.xxx.xxx:xxxx/axis-cgi/record/list.cgi?recordingid=all&maxnumberofresults=50”
tt_socket.SetRequestHeader(“Authorization”, “Basic " + EncodeBase64(“user”+”:"+“password”))
tt_response = tt_socket.Get( tt_query_works, 10 )
MsgBox DefineEncoding(tt_response, Encodings.UTF8)
tt_response = tt_socket.Get( tt_query_no_works, 10 )
MsgBox DefineEncoding(tt_response, Encodings.UTF8)[/code]
None of that calls are related, and can be called independently and in no-order, as we are doing with other tools, like cUrl or Ruby.
Thanks in advance,
regards,
r.