HTTP/1.1 400 Method 'ptzgetabsoluteposition' not implemented

Hi. Im trying to implement pooling service that will with some periods retreive PTZ information about camera.

I use XProtect Corporate 2018 R3

I try to use ImageServer session to an XProtect Recording Server.

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

I able to connect using sockets with this code(Node js example) :

const net = require('net');
const client = net.Socket();
client.connect(7563, 'host');
client.setKeepAlive(true);
 
client.on('data', (data) => console.log(data.toString()));
 
client.on('error', (err) => console.log("ERROR"));
 
client.on('close', () => console.log("Closed"));
 
client.on('connect', function(data) {
    var login = `<?xml version="1.0" encoding="UTF-8"?><methodcall><requestid>1</requestid><methodname>connect</methodname><username>dummy</username><password>dummy</password><cameraid>[myCameraId]</cameraid><connectparam>id=[myCameraId]&amp;connectiontoken=[myToken]</connectparam></methodcall>\r\n\r\n`;
    client.write(login);
});

From this snippet i receive success response like this :

<?xml version="1.0" encoding="UTF-8"?><methodresponse><requestid>1</requestid><methodname>connect</methodname><connected>yes</connected><errorreason>Success</errorreas
on><includehasmotionflags>no</includehasmotionflags><includesequencenumber>no</includesequencenumber><includesignatures>no</includesignatures><alwaysstdjpeg>no</always
stdjpeg><transcode><allframes>no</allframes></transcode><clientcapabilities><privacymask>no</privacymask><privacymaskversion>0</privacymaskversion><multipartdata>no</m
ultipartdata><datarestriction>no</datarestriction></clientcapabilities><servercapabilities><connectupdate>yes</connectupdate><signatures>yes</signatures></servercapabi
lities></methodresponse>

Now i can use some methods from documentation like :

ptz

ptzcenter

But when it try to send ptzgetabsoluteposition

//try to get camera PTZ
    var ptz = `<?xml version="1.0" encoding="UTF-8"?><methodcall><requestid>1</requestid><methodname>ptzgetabsoluteposition</methodname><deviceid><guid>[deviceId]</guid></deviceid></methodcall>\r\n\r\n`;
    client.write(ptz);

I receive error

HTTP/1.1 400 Method ‘ptzgetabsoluteposition’ not implemented

I see that this method uses POST request to obtain data.

Now my question is. Will i be able to receive this data using socket connection or im forced to use HTTP POST request to /RecorderCommandService/RecorderCommandService.asmx

which works fine.

Update:

I tried to wrap porst request data into string and send via socket. Here is what i get :

var ptz = `POST /imageserver?methodcall=ptzgetabsoluteposition HTTP/1.1\r\nContent-Type: text/xml;\r\nX-Protocol: lean\r\nX-RequestId: 3\r\nAccept-Encoding: identity\r\nContent-Length: 137\r\nHost: windev1809eval:7563\r\nAuthorization: Basic YWStaW46YWRtaW2=\r\n\r\n<?xml version='1.0' encoding='UTF-8'?><methodcall><deviceid><guid>[myCameraId]</guid></deviceid></methodcall>\r\n\r\n`;
 
client.on('connect', function(data) {
//login requests here. Which return OK info
    //try to get camera PTZ
    client.write(ptz );
});

This return response like this :

HTTP/1.1 403 Forbidden
Content-Length: 0
X-MethodName: ptzgetabsoluteposition
X-RequestId: 3

If i try to remove \r\n after Authorization to make sure than request ends after xml data i get

client.write(`POST /imageserver?methodcall=ptzgetabsoluteposition HTTP/1.1\r\nContent-Type: text/xml;\r\nX-Protocol: lean\r\nX-RequestId: 3\r\nAccept-Encoding: identity\r\nContent-Length: 137\r\nHost: windev1809eval:7563\r\nAuthorization: Basic YWRtaW46YWRtaW4=\r\n<?xml version='1.0' encoding='UTF-8'?><methodcall><deviceid><guid>[MyCameraId]</guid></deviceid></methodcall>\r\n\r\n`);
 
Response : 
 
HTTP/1.1 400 Bad Request
Content-Type: text/xml
Content-Length: 35
Connection: Keep-Alive
 
<h1>HTTP/1.1 400 Bad Request</h1>

Maybe im missing something obviuos.

Thank you.

@Bo Ellegård Andersen (Milestone Systems)​ Any clues on this?

Maybe some example in C or just hint how to make valid request to /imageserver?methodcall=ptzgetabsoluteposition using TCP connection.

Thank you.

Not supported on the protocol when doing c-code..

http://doc.developer.milestonesys.com/html/index.html?base=reference/architecture/product_support.html&tree=tree_3.html

When on c-code you can instead use the Recorder Command Service Soap protocol, You actually see this in he table above the one for Image Server protocol.

Omg. Thank you for answer. I were looking there but missed(((.

One mor question.

In future is it possible that PTZGetAbsolutePosition and PTZSetAbsolutePosition in “ImageServer Protocol” will be supported for C-code?

No, I find it unlikely that the Image Server protocol will be changed in this respect.

If you run the PTZandPresets sample (component sample / .Net library) and at the same time trace the network communication using Wireshark or similar you will be able to see the protocol requests and responses, this might be useful for your development work. Maybe this will help you on using the Recorder Command Service and PTZGetAbsolutePosition on that protocol.

@Bo Ellegård Andersen (Milestone Systems)​ thank you for feedback. I am able to receive that data using Recorder Command Service so i guess will stick to that implementation.

Thank you for your time. It was very helpful.