Unauthorised error when connecting to milestone via tcpvideoviewer sample application

Thanks Bo,

I changed the Url but still getting a 401 Unauthorized error.

Any other ideas?

Here is the Fiddler trace.

I was able to get a response after regenerating the client using WSDL from https:///ManagementServer/ServerCommandService.svc.

I am getting an error after receiving the configuration

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://videoos.net/2/XProtectCSServerCommand:GetConfigurationResult. The InnerException message was ‘Error in line 1 position 94162. ‘EndElement’ ‘GetConfigurationResult’ from namespace ‘http://videoos.net/2/XProtectCSServerCommand’ is not expected. Expecting element ‘alertTypeGroupsField’.’. Please see InnerException for more details.

Fiddler trace

You should deliver the user name and password in the login call. A developer gave the following as inspiration for you..

       internal static void SetCredentials(System.ServiceModel.Description.ClientCredentials clientCredentials, ICredentials credentials, Uri serverAddress)
        {
            bool isBasicUser = IsBasicUser(credentials, serverAddress);
            if (isBasicUser)
            {
                Uri uri = new UriBuilder(serverAddress.Scheme, serverAddress.Host, serverAddress.Port).Uri;
                NetworkCredential nc = credentials.GetCredential(uri, "Basic");
                string username;
                if (string.IsNullOrEmpty(nc.Domain))
                {
                    username = nc.UserName;
                }
                else
                {
                    username = nc.Domain + "\\" + nc.UserName;
                }
                clientCredentials.UserName.UserName = username;
                clientCredentials.UserName.Password = nc.Password;
            }
            else
            {
                clientCredentials.Windows.ClientCredential = credentials.GetCredential(serverAddress, "Negotiate");
            }
            clientCredentials.SupportInteractive = false;
        }

Thanks Bo,

I will use that code sample. What about the deserialization error I posted here? Thank you very much for your help.

Here is the modified LoginDotNetSoap project that I can login with but cannot get the configuration to deserialize. Includes the WSDL generated MilestoneClient1.cs file. Please review and let me know how I should proceed further.

Thanks

Below is the XML I receive from GetConfiguration that fails to deserialize:

Hi Ruslan,

There is unfortunately a difference in the order of elements in the .asmx and .svc respectively. This means that you will have to generate full proxy code for each of the interfaces and cannot share classes etc between them.

We are aware of this issue (which has been there for a long time), but in order to keep compatibility with clients written for previous versions we can unfortunately not correct it.

I tried running your sample with a full proxy generated for the .svc and then it worked fine.

/Peter

Hi Peter,

I generated a full proxy using the following syntax:

wsdl /out:MilestoneClient.cs http://d110/ManagementServer/ServerCommandService.svc?wsdl

I verified that there is only one definition of ConfigurationInfo and it’s in MilestoneClient.cs.

Still getting the same error.

Select Corporate or Enterprise (C or E) [C]:C

Enter IP address and port for an XProtect VMS [localhost:80] : d110:443

Enter username or blank for default credentials: audit1

Enter domain (For basic users write: BASIC): BASIC

Enter password: M1lest0ne

Token returned: TOKEN#0193cd85-69e0-46f9-8968-3b6f1e6cb99f#d110.corp.arrowsight.com//ServerConnector#

Token is valid for: 14400000 seconds

Unable to get configuration: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://videoos.net/2/XProtectCSServerCommand:GetConfigurationResult. The InnerException message was ‘Error in line 1 position 94162. ‘EndElement’ ‘GetConfigurationResult’ from namespace ‘http://videoos.net/2/XProtectCSServerCommand’ is not expected. Expecting element ‘alertTypeGroupsField’.’. Please see InnerException for more details.

Attached is my generated by WSDL MilestoneClient.cs file

Can you please let me know the exact steps you took to generate the proxy.

Thank you very much for your assistance.

Thanks,

Ruslan

Hi again,

I generated the proxy using Visual Studios build in functionality and then removed all of your existing proxy classes, including the client class. I guess the latter is the main difference from what you have done as the client is not included in the MilestoneClient code you posted.

I have attached my modified version of your project, which works fine on my pc. Basically the Reference.cs is what was generated by VS. I generated it in another project and copied it to yours, to get as small a modification as possible in your project.

Best regards,

Peter

PS: You have included your login info in the above trace - don’t know if that was intentional.

Thank you very much for your response. I was able to get around by porting the proxy generated classes into LoginDotNetSoap_SSL namespace but I will use your sample code to get further.

I assume that playback should work fine with basic authentication too. Is that supported with Corporate?

Thank you so much for your assistance.

Yes that is supported.

Thank you Peter