Obtain Status of device - (How get Token and instance id ???)

One of our customers has xprotect corporate. I need to access camera status and other configuration information from a web application.

From the documentation I saw that in my case I have to use the SOAP Protocol. I am doing some tests with SoapUI, I connected using the following url

http: //localhost/Managementserver/ServerCommandService.svc? wsdl

It happens that SoapUI returns me two interfaces

BasicHttpBinding_IServerCommandService

WSHttpBinding_IServerCommandService

What is the difference between these two interfaces?

I tried a Login Request from BasicHttpBinding_IServerCommandService

The Login request expects two values in input: istanceID and Token

How can obtain this two value ?

I need to understand how to access these calls and in particular I need to know if a camera is working or not working.

Maybe there is a better way to query the status of the devices?

Thanks in advance

This help page might be helpful for you -

https://doc.developer.milestonesys.com/html/index.html?base=gettingstarted/intro_soap_protocols.html&tree=tree_3.html

Please explore this sample - https://doc.developer.milestonesys.com/html/index.html?base=samples/analyticseventlibrary.html&tree=tree_search.html?search=analytics+event

I’m sorry but I did not understand.

I try to break down the question to understand. We have installed Xprotect Corporate. Before ask my question I followed the documentation on your page https://doc.developer.milestonesys.com/html/index.html?base=gettingstarted/intro_soap_protocols.html&tree=tree_3.html

Questions:

1) We need to get information about the status of a device (camera status) for a web application .

2)Keeping in mind that we do not connect from C # but from node.js. Which in your opinion is the best protocol integration?

3) Keeping in mind that in my Xprotect Corporate Test installation I have users defined locally (and not on Active Directory) and I don’t have SSL. The only way seems to be to use the RecorderStatusService / RecorderStatusService2.asmx path to ask for the status of a camera . This reasoning is correct or I am wrong ?

4) Is it always necessary to have a token to access the services?

5) In my specific case how to get a token ?

6) Do You have an example that can help me ?

Thanks

  1. We need to get information about the status of a device (camera status) for a web application .

q.

Keeping in mind that we do not connect from C # but from node.js. Which in your opinion is the best protocol integration?

a.

Obtain a token using Server Command Service. (using Windows or AD users require NTML, using Basic users require SSL.) Obtain status information from Status SOAP Protocol (http://localhost:7563/recorderstatusservice/recorderstatusservice2.asmx).

q.

Keeping in mind that in my XProtect Corporate Test installation I have users defined locally (and not on Active Directory) and I don’t have SSL. The only way seems to be to use the RecorderStatusService / RecorderStatusService2.asmx path to ask for the status of a camera . This reasoning is correct or I am wrong ?

a.

Yes, correct.

q.

Is it always necessary to have a token to access the services?

a.

Yes.

q.

In my specific case how to get a token?

a.

Server Command Service. When you are using a local Windows user make sure to have NTLM. If using basic user make sure to use SSL.

q.

Do You have an example that can help me?

a.

Yes. We do not have node.js samples. I strongly recommend to explore the Login. Net Soap sample (and underlying ServerCommandWrapper) for the login and token. I recommend to explore the Status Console sample for getting status. The samples are not node.js, but will contain valuable information.

https://doc.developer.milestonesys.com/html/index.html?base=samples/logindotnetsoap.html&tree=tree_3.html

https://doc.developer.milestonesys.com/html/index.html?base=samples/statusdemoconsole_sample.html&tree=tree_2.html

One more step and I’m almost there.

The goal is always to get the status of a device. I understood that the correct sequence in the case of basic Authenticarion and SSL is the following:

  1. I create my Guid for InsstanceID for example:

97088254-afd7-4014-849e-4aadd5f91874

  1. I get the Token through the login method of the end point https: // /ManagementServer/ServerCommandService.svc

QUESTION:

<soapenv: Envelope xmlns: soapenv = “http://schemas.xmlsoap.org/soap/envelope/” xmlns: xpr = “http://videoos.net/2/XProtectCSServerCommand”>

<soapenv: Header />

<soapenv: Body>

<xpr: Login>

 <! - Optional: ->

 <xpr: instanceId> **97088254-afd7-4014-849e-4aadd5f91874** </ xpr: instanceId>

 <! - Optional: ->

 <xpr: currentToken> </ xpr: currentToken>

</ xpr: Login>

</ soapenv: Body>

</ soapenv: Envelope>

REPLY:

The answer is this:

<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](http://www.w3.org/2001/XMLSchema-instance "http://www.w3.org/2001/XMLSchema-instance")">

  <RegistrationTime> 2020-11-23T12: 57: 07.213Z </RegistrationTime>

  <TimeToLive>

    <MicroSeconds> 14400000000 </MicroSeconds>

  </TimeToLive>

  <TimeToLiveLimited> false </TimeToLiveLimited>

  <Token>**TOKEN # aae540bf-0bc3-4deb-9d02-354c13c64d52 # 4msvms // ServerConnector #**</Token>

 </LoginResult>

</ s: Body>

</ s: Envelope>

  1. I get a deviceID via GetConfiguration of the end point https: // /ManagementServer/ServerCommandService.svc

QUESTION

<soapenv: Envelope xmlns: soapenv = “http://schemas.xmlsoap.org/soap/envelope/” xmlns: xpr = “http://videoos.net/2/XProtectCSServerCommand”>

<soapenv: Header />

<soapenv: Body>

<xpr: GetConfiguration>

 <! - Optional: ->

 <xpr: token>**TOKEN # aae540bf-0bc3-4deb-9d02-354c13c64d52 # 4msvms // ServerConnector #**</ xpr: token>

</ xpr: GetConfiguration>

</ soapenv: Body>

</ soapenv: Envelope>

and from the content (only a part) of the answer I take a deviceid of a camera

<Recorders>

    <RecorderInfo>

     <Cameras>

       <CameraInfo>

        <CoverageDepth> 0 </CoverageDepth>

        <CoverageDirection> 0 </CoverageDirection>

        <CoverageFieldOfView> 0 </CoverageFieldOfView>

        <Description />

        <DeviceId>**62f57c0d-44fc-4825-a285-89223a041729**</DeviceId>

        <DeviceIndex> 0 </DeviceIndex>

        <GisPoint> POINT EMPTY </GisPoint>

        <HardwareId> 947df69a-96b0-4d8f-963e-02f116baf0f1 </HardwareId>

        <Icon> 0 </Icon>

        <Name> HikVisionGeneric (10.0.5.12) - Room 1 </Name>

        <RecorderId> 7e5750b6-3be2-4740-9247-f310a0f8f94c </RecorderId>

Now that I have the Token and the device ID I can use the GetCurrentDeviceStatus method from the End Point http:///recorderstatusservice/recorderstatusservice2.asmx

I ask the question:

<soapenv: Envelope xmlns: soapenv = “http://schemas.xmlsoap.org/soap/envelope/” xmlns: xpr = “http://videoos.net/2/XProtectCSRecorderStatus2”>

<soapenv: Header />

<soapenv: Body>

<xpr: GetCurrentDeviceStatus>

 <! - Optional: ->

 <xpr: token>**TOKEN # aae540bf-0bc3-4deb-9d02-354c13c64d52 # 4msvms // ServerConnector #**</ xpr: token>

 <! - Optional: ->

 <xpr: deviceIds>

  <! - Zero or more repetitions: ->

  <xpr: guid>**62f57c0d-44fc-4825-a285-89223a041729**</ xpr: guid>

 </ xpr: deviceIds>

</ xpr: GetCurrentDeviceStatus>

</ soapenv: Body>

</ soapenv: Envelope>

But in response I get this error which I don’t understand what it means

<soap: Envelope xmlns: xsi = “http://www.w3.org/2001/XMLSchema-instance” xmlns: xsd = “http://www.w3.org/2001/XMLSchema” xmlns: soap = "http : //schemas.xmlsoap.org/soap/envelope/ ">

<soap: Body>

<soap: Fault>

 <faultcode> soap: Server </faultcode>

 <faultstring> Error processing message </faultstring>

 <detail>

  <ErrorNumber> 10000 </ErrorNumber>

 </detail>

</ soap: Fault>

</ soap: Body>

</ soap: Envelope>

Where did I go wrong

I am also having same issue, anyone found the cause?