Issues with SOAP PTZ commands.

I would like to be able to move the camera from a remote Java app,

so I am issuing commands to SOAP endpoints from RecorderCommandService in RecordingService.

Issuing PTZMoveHome moves the camera.

------------------------------------------------------------------------------------------------------------------------

POST http://redacted:7563/recordercommandservice/recordercommandservice.asmx HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: application/soap+xml;charset=UTF-8;action=“http://videoos.net/2/XProtectCSRecorderCommand/PTZMoveHome

Content-Length: 434

Host: redacted:7563

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.2)

<soap:Envelope xmlns:soap=“http://www.w3.org/2003/05/soap-envelope” xmlns:xpr=“http://videoos.net/2/XProtectCSRecorderCommand”>

soap:Header/

soap:Body

xpr:PTZMoveHome

 <xpr:token>redacted</xpr:token>

 <xpr:deviceId>redacted</xpr:deviceId>

</xpr:PTZMoveHome>

</soap:Body>

</soap:Envelope>

------------------------------------------------------------

HTTP/1.1 200 OK

Server: XProtect Recording Server 23.3a

Date: Fri, 26 Apr 2024 21:59:49 GMT

Cache-Control: private, max-age=0

Content-Type: application/soap+xml; charset=utf-8

Content-Length: 354

<?xml version="1.0" encoding="utf-8"?>

------------------------------------------------------------------------------------------------------------------------

And so does PTZCenter

------------------------------------------------------------------------------------------------------------------------

POST http://redacted:7563/recordercommandservice/recordercommandservice.asmx HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: application/soap+xml;charset=UTF-8;action=“http://videoos.net/2/XProtectCSRecorderCommand/PTZCenter

Content-Length: 650

Host: redacted:7563

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.2)

<soap:Envelope xmlns:soap=“http://www.w3.org/2003/05/soap-envelope” xmlns:xpr=“http://videoos.net/2/XProtectCSRecorderCommand”>

soap:Header/

soap:Body

xpr:PTZCenter

 <xpr:token>TOKEN#8a619bee-a179-4b46-abdf-ff7dcfceddda#win-2vdcb5rupgo//ServerConnector#</xpr:token>

 <xpr:deviceId>53d8c78b-8456-49df-9f5a-939db7e2988b</xpr:deviceId>

 <xpr:refWidth>100</xpr:refWidth>

 <xpr:refHeight>100</xpr:refHeight>

 <xpr:centerX>50</xpr:centerX>

 <xpr:centerY>50</xpr:centerY>

 <xpr:zoom>0.5</xpr:zoom>

</xpr:PTZCenter>

</soap:Body>

</soap:Envelope>

------------------------------------------------------------

HTTP/1.1 200 OK

Server: XProtect Recording Server 23.3a

Date: Fri, 26 Apr 2024 22:01:59 GMT

Cache-Control: private, max-age=0

Content-Type: application/soap+xml; charset=utf-8

Content-Length: 350

<?xml version="1.0" encoding="utf-8"?>

------------------------------------------------------------------------------------------------------------------------

PTZMoveStart does nothing. RecordingServer returns 200 OK, but the camera does not move.

------------------------------------------------------------------------------------------------------------------------

POST http://redacted:7563/recordercommandservice/recordercommandservice.asmx HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: application/soap+xml;charset=UTF-8;action=“http://videoos.net/2/XProtectCSRecorderCommand/PTZMoveStart

Content-Length: 815

Host: redacted:7563

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.2)

<soap:Envelope xmlns:soap=“http://www.w3.org/2003/05/soap-envelope” xmlns:xpr=“http://videoos.net/2/XProtectCSRecorderCommand”>

soap:Header/

soap:Body

xpr:PTZMoveStart

 <xpr:token>redacted</xpr:token>

 <xpr:deviceId>redacted</xpr:deviceId>

 <xpr:ptzArgs>

  <xpr:movement>

    <xpr:name>zoom</xpr:name>

    <xpr:value>0.1</xpr:value>

  </xpr:movement>

  <xpr:speed>

    <xpr:name>zoom</xpr:name>

    <xpr:value>0.5</xpr:value>

  </xpr:speed>

  <xpr:Normalized>false</xpr:Normalized>

 </xpr:ptzArgs>

</xpr:PTZMoveStart>

</soap:Body>

</soap:Envelope>

------------------------------------------------------------

HTTP/1.1 200 OK

Server: XProtect Recording Server 23.3a

Date: Fri, 26 Apr 2024 22:04:31 GMT

Cache-Control: private, max-age=0

Content-Type: application/soap+xml; charset=utf-8

Content-Length: 356

<?xml version="1.0" encoding="utf-8"?>

------------------------------------------------------------------------------------------------------------------------

PTZRectangle, PTZMoveAbsolute, and PTZRelative behave same as PTZMoveStart - 200 OK - but no effect on the camera position.

I tried to pan and titlt, so this is not a zoom-specific issue.

I tried various values to make sure that the camera is not already in the requested position.

I tried to send values that should have resulted in an error, but got 200 OK.

I tried SOAP 1.1 and SOAP 1.2.

I tried to play with XML namespaces.

Nothing helps.

The user I am authenticated as has “Administrator” role, so I believe it has authorization to move the camera.

When I make those request, that do not result in camera movement,

I can see in Milestone XProtect Smart Client that a session has been created for those requests, because Smart Client, temporarily, refuses to move the camera, and I can see my username in the error message.

I would like for the SOAP commands that do not result in camera movement to move the camera. What could I be doing wrong?

Milestone XProtect Smart Client has no problem with moving the camera. Is it calling something else?

I am not too attached to calling those SOAP endpoints, so I am happy to explore other solutions to moving the camera that could be accomplished in a remote Java app.

If you would like me to attach some logs from a specific file, please let me know.

Thanks.

I consulted a developer on what this could be and if he had hints for troubleshooting, I think the troubleshooting he suggested is quite thorough and I will give it unmodified..

-.-

From my first look at it, I don’t see why it shouldn’t work.

Maybe it would be worth checking the trace from the recording server using dbgview.exe (can be downloaded from https://live.sysinternals.com)

Doing a zoom start and stop should show something like this:

[4996] ##### PtzMoveHandler.MoveStart(In)

[4696] 08:06:39.7535 InteropPtzCameraDeviceDriver::Move(), p:0;0, t:0;0, z:1;1

[4696] 08:06:39.7545 InteropPtzCameraDeviceDriver::Move() done

[4996] ##### PtzMoveHandler.MoveStop()

[4996] Stop

[4696] 08:06:41.1127 InteropPtzCameraDeviceDriver::Move(), p:0;0, t:0;0, z:0;0

[4696] 08:06:41.1127 InteropPtzCameraDeviceDriver::Move() done

You can also enable debug logging in “[C:\Program](file:C:/Program) Files\Milestone\XProtect Recording Server\VideoOS.Recorder.Service.exe.config” by changing ‘level’ from info to debug

     <Appender type="File" **level="info"** filename="~/Logs/PtzManager.log" archive="~/Logs/Archive" maxsize="10" />

To

     <Appender type="File" **level="debug"** filename="~/Logs/PtzManager.log" archive="~/Logs/Archive" maxsize="10" />

Then in “[C:\ProgramData\Milestone\XProtect](file:C:/ProgramData/Milestone/XProtect) Recording Server\Logs\PtzManager.log” you should see something like this:

2024-04-30 08:20:45.311+02:00 [ 66] DEBUG - PtzController: Executed Ptz request (VideoOS.Recorder.MoveStopPtzRequest) on device 667ce26c-fa5c-4cb2-9c5b-836cc1996438

2024-04-30 08:20:45.311+02:00 [ 66] DEBUG - PtzController: Executed Ptz request (MovePtzRequest; Pan: 0 (0); Tilt: 0 (0); Zoom: -1 (1):wink: on device 667ce26c-fa5c-4cb2-9c5b-836cc1996438

2024-04-30 08:20:50.403+02:00 [ 126] DEBUG - PtzController: Executed Ptz request (MovePtzRequest; Pan: 0 (0); Tilt: 0 (0); Zoom: 0 (0):wink: on device 667ce26c-fa5c-4cb2-9c5b-836cc1996438

You may get other logs or maybe even some errors, but that might help identifying why the command doesn’t work.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xpr="http://videoos.net/2/XProtectCSRecorderCommand">
  <soapenv:Header/>
  <soapenv:Body>
   <xpr:PTZMoveStart>
     <xpr:token>redacted</xpr:token>
     <xpr:deviceId>redacted</xpr:deviceId>
     <xpr:ptzArgs>
      <xpr:movement>
        <xpr:name>pan</xpr:name>
        <xpr:value>1</xpr:value>
      </xpr:movement>
      <xpr:speed>
        <xpr:name>pan</xpr:name>
        <xpr:value>0.1</xpr:value>
      </xpr:speed>
      <xpr:Normalized>false</xpr:Normalized>
     </xpr:ptzArgs>
   </xpr:PTZMoveStart>
  </soapenv:Body>
</soapenv:Envelope>

results in

[9140] 09:03:49.1304 InteropPtzCameraDeviceDriver::Move(), p:NaN;NaN, t:NaN;NaN, z:NaN;NaN 
[9140] 09:03:49.1304 InteropPtzCameraDeviceDriver::Move(), p:NaN;NaN, t:NaN;NaN, z:NaN;NaN 
[9140] 09:03:49.1304 InteropPtzCameraDeviceDriver::Move() done 
[9140] 09:03:49.1304 InteropPtzCameraDeviceDriver::Move() done

in dbgview64.exe

I played with namespaces even more and it turns our that those are indeed the issue.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header/>
  <soapenv:Body>
   <PTZMoveStart xmlns="http://videoos.net/2/XProtectCSRecorderCommand">
     <token>redacted</token>
     <deviceId>redacted</deviceId>
     <ptzArgs>
      <movement>
        <name>pan</name>
        <value>1</value>
      </movement>
      <speed>
        <name>pan</name>
        <value>0.1</value>
      </speed>
      <Normalized>false</Normalized>
     </ptzArgs>
   </PTZMoveStart>
  </soapenv:Body>
</soapenv:Envelope>

results in

[9140] 09:31:11.6651 InteropPtzCameraDeviceDriver::Move(), p:1;0.1, t:NaN;NaN, z:NaN;NaN 
[9140] 09:31:11.6651 InteropPtzCameraDeviceDriver::Move(), p:1;0.1, t:NaN;NaN, z:NaN;NaN 
[9140] 09:31:11.7251 InteropPtzCameraDeviceDriver::Move() done 
[9140] 09:31:11.7251 InteropPtzCameraDeviceDriver::Move() done

and the camera moves.

Same thing with other commands.

The first XML has been generated by SoapUI from WSDL at /RecorderCommandService/RecorderCommandService.asmx?wsdl.

I am not a SOAP expert, but I suspect you might be handling that incorrectly.

However, I can make this work on my side.

Thanks.

For reference, Spring (the most popular Java framework) Web Services with JAXB marshals data into XML that has those prefixes. So it is not only SoapUI.

I am currently trying to figure out how to make it serialize into a form that your system works with.

Hello Maciej,

You’re absolutely right.

The XML you have provided in your initial question, with the namespace alias xpr: on each node - is valid XML and should be read correctly.

However, I have checked the code that reads the xml and it is in fact reading the content incorrectly, as it uses the node.Name incorrectly and thereby not taking into account, that the name may be prefixed with the namespace alias .

I will make sure that this is registered as a bug.

Thank you for making us aware about this and I’m sorry for the troubles that this has caused you.

PTZMoveStart, PTZMoveAbsolute, and PTZRelative is fixed in the next release 2024-R2.

Cound not find anything wrong with PTZRectangle :slight_smile: