Wrong header error from the server

Hi there,

We are authenticated and try to get all alarms but receive a wrong header error from the serve.

Can you please advice if the port 22331 is the correct one, the headers we send are correct ones and if the xml is the one that server expect.

We send:

POST /Central/AlarmServiceToken HTTP/1.1

Content-Type: text/xml; charset=utf-8

SOAPAction: “http://videoos.net/2/CentralServerAlarmCommand/IAlarmCommandToken/GetAlarmLines

Host: 10.100.100.19:22331

Content-Length: 569

Expect: 100-continue

Accept-Encoding: gzip, deflate

<s:Envelope xmlns:s=“http://schemas.xmlsoap.org/soap/envelope/”>

<s:Body>

<GetAlarmLines xmlns=“http://videoos.net/2/CentralServerAlarmCommand”>

 <token>TOKEN#BE107F5F-AFBC-42BF-8D9F-032544EA6681#[127.0.0.1:7080#](http://127.0.0.1:7080/# "http://127.0.0.1:7080/#")</token>

 <from>0</from>

 <maxCount>10</maxCount>

 <filter xmlns:a="[http://schemas.datacontract.org/2004/07/VideoOS.Platform.Proxy.Alarm](http://schemas.datacontract.org/2004/07/VideoOS.Platform.Proxy.Alarm "http://schemas.datacontract.org/2004/07/VideoOS.Platform.Proxy.Alarm")" xmlns:i="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance "http://www.w3.org/2001/XMLSchema-instance")">

  <a:Conditions i:nil="true" />

  <a:Orders>

    <a:OrderBy>

     <a:Order>Descending</a:Order>

     <a:Target>Timestamp</a:Target>

    </a:OrderBy>

  </a:Orders>

 </filter>

</s:Body>

</s:Envelope>

And receive back:

HTTP/1.1 400 Bad Request

Content-Type: text/html; charset=us-ascii

Server: Microsoft-HTTPAPI/2.0

Date: Wed, 02 Oct 2019 19:30:00 GMT

Connection: close

Content-Length: 339

Bad Request

Bad Request - Invalid Header


HTTP Error 400. The request has an invalid header name.

Can you please assist?

Could you please explore this sample? - https://doc.developer.milestonesys.com/html/index.html?base=samples/alarmlist_sample.html&tree=tree_3.html

This might be helpful.

Thank you Rie,

We would appreciate if you could respond with the port, required headers and an XML sample rather than pointing us to the .net sample.

Can you please explain how to get all the alarms using protocol integration and not .NET?

We were able to get through the invalid header error using wireshark.

Now we are facing another error - invalid authentication.

We get the token from the server:

HTTP/1.1 200 OK

Cache-Control: private

Content-Type: text/xml; charset=utf-8

Server: Microsoft-IIS/10.0

X-AspNet-Version: 4.0.30319

X-Powered-By: ASP.NET

X-Frame-Options: SAMEORIGIN

Date: Fri, 04 Oct 2019 14:20:17 GMT

Connection: close

Content-Length: 515

<s:Envelope xmlns:s=“http://schemas.xmlsoap.org/soap/envelope/”><s:Body><LoginResponse xmlns=“http://videoos.net/2/XProtectCSServerCommand”><LoginResult xmlns:i=“http://www.w3.org/2001/XMLSchema-instance”>2019-10-04T14:20:17.373Z14400000000falseTOKEN#176c9cc3-b6cd-4d59-b3ae-c20d331e0ff6#milestonemgr//ServerConnector#</s:Body></s:Envelope>

Then we insert received 176C9CC3-B6CD-4D59-B3AE-C20D331E0FF6:

POST /Central/AlarmServiceToken HTTP/1.1

Content-Type: text/xml; charset=utf-8

SOAPAction: “http://videoos.net/2/CentralServerAlarmCommand/IAlarmCommandToken/GetAlarmLines

Host: 10.95.204.19:22331

Content-Length: 569

Expect: 100-continue

Accept-Encoding: gzip, deflate

<s:Envelope xmlns:s=“http://schemas.xmlsoap.org/soap/envelope/”>

<s:Body>

 <token>TOKEN#176C9CC3-B6CD-4D59-B3AE-C20D331E0FF6#milestonemgr//ServerConnector#</token>

 <from>0</from>

 <maxCount>10</maxCount>

 <filter xmlns:a="[http://schemas.datacontract.org/2004/07/VideoOS.Platform.Proxy.Alarm](http://schemas.datacontract.org/2004/07/VideoOS.Platform.Proxy.Alarm)" xmlns:i="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)">

  <a:Conditions/>

  <a:Orders>

    <a:OrderBy>

     <a:Order>Descending</a:Order>

     <a:Target>Timestamp</a:Target>

    </a:OrderBy>

  </a:Orders>

 </filter>

</s:Body>

</s:Envelope>

and get the following error:

HTTP/1.1 500 Internal Server Error

Content-Length: 485

Content-Type: text/xml; charset=utf-8

Server: Microsoft-HTTPAPI/2.0

Date: Fri, 04 Oct 2019 14:20:17 GMT

<s:Envelope xmlns:s=“http://schemas.xmlsoap.org/soap/envelope/”><s:Body><s:Fault>s:ClientInvalid authentication<AlarmServiceFault xmlns=“http://schemas.datacontract.org/2004/07/VideoOS.Platform.Proxy.Alarm” xmlns:i=“http://www.w3.org/2001/XMLSchema-instance”>Invalid authenticationInvalidAuthentication</s:Fault></s:Body></s:Envelope>

Please advice!

Could you please check the Role setup in the Management Client? In most cases the error you received is due to the user not having rights to read alarms.

If that doesn’t provide any information, please review the Event Server and Management Server log files - to find what part is throwing the 500 exception. If you find the log message and it is not obvious what is wrong, please send it to us for further investigation.

Please also note that AlarmCommandToken is used for Basic users, while AlarmCommand is used for AD users (with NTLM protocol below SOAP)

We’ll check the role but as far as I know it has all permissions required.

Can we get a clear NON-MICROSOFT example on how to get all alarms from your system? Pure XML please…

We would prefer to use AlarmCommandToken even though we are able to generate an NTLM credentials on our end if required…

If you use basic user account, you can use AlarmCommandToken in an HTTPS session. No NTLM is required in that case.

Example please

Sorry, but we don’t have a non-Microsoft sample. However, the sample Rie initially referred to does show how to do a pure protocol based integration, so should be possible to see how to do it from that even though it is in another programming language.

If you keep having problems please let us know if you have any errors in the log files previously mentioned and we should then be able to provide som guidance based on that.

Hello Stan,

I would like to add something on top of what Peter has said. This is a WCF service. We do not generate XML ourselves, its auto generated by the WCF client. The WCF client is also auto-generated via Visual Studio utility.

Do not hesitate to contact us in case of further questions