Home AMX User Forum NetLinx Studio

NEED HELP TO CONTROL PELCO IP CAM USING SOAP OVER HTTP

HI GUYS I'M BUILDING MY PROGRAM AND I NEED YOUR HELP IN THIS

I HAVE A PELCO IP CAMERA IT USES SOAP OVER HTTP FOR CONTROL

I HAVE SUCCEEDED CONTROLLING IT WITH SOAPUI PROGRAM SO NOW I KNOW ALL THE SOAP MESSAGES
TO BE SENT TO THE CAMERA
FOR PTZ, ZOOMING, PRESETS

FOR EXAMPLE
TO MAKE THE CAMERA MOVE TO THE RIGHT
YOU SEND
"<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:urn="urn:schemas-pelco-com:service:PositioningControl:1">
<soapenv:Header/>
<soapenv:Body>
<urn:SetVelocity>
<velocity>
<rotation>
<x>10000</x> //THE SPEED OF THE CAM
</rotation>
</velocity>
</urn:SetVelocity>
</soapenv:Body>
</soapenv:Envelope>

"
THEN YOU SEND THIS TO STOP
"
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:urn="urn:schemas-pelco-com:service:PositioningControl:1">
<soapenv:Header/>
<soapenv:Body>
<urn:SetVelocity>
<velocity>
<rotation>
<x>0</x> //0 TO MAKE IT STOP
</rotation>
</velocity>
</urn:SetVelocity>
</soapenv:Body>
</soapenv:Envelope>

"


SO THE PROBLEM FOR ME IS HOW TO FIGURE OUT THE HTTP HEADER AND MERGING IT WITH THE SOAP THEN HOW TO SEND IT
BECAUSE I HAVE TRIED SENDING ASCII MESSAGE USING DOCKLIGHT SCRIPTING PROGRAM BUT THE CAM SERVER
RESPONSES WITH ERROR IN CLIENT

POST /control/PositioningControl-1 HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "urn:schemas-pelco-com:service:PositioningControl:1#SetPosition"
Content-Length: 378
Host: 192.168.0.20:49152
Connection: Keep-Alive
User-Agent: HTTP/1.1

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:urn="urn:schemas-pelco-com:service:PositioningControl:1">
<soapenv:Header/>
<soapenv:Body>
<urn:SetPosition>
<position>
<rotation>
<x>10000</x>
</rotation>
</position>
</urn:SetPosition>
</soapenv:Body>
</soapenv:Envelope>

CAN U PLEASE SHOW ME HOW TO SEND THIS USING NETLINX

Comments

  • a_riot42a_riot42 Posts: 1,624
    Your user agent doesn't look correct but that shouldn't make it not work. The packet looks ok to me. What error message are you getting? Why don't you post your code? All caps isn't necessary, we have pretty good hearing here in the AV forums.
    Paul
  • msfayadmsfayad Posts: 18
    Thanks alot for your reply

    You know I'm building a module for the camera to be used again ,tomorrow i will test the string on my ni3100 and if it worked i will continue building the module.
    You said user-agent: looks wrong .what is the user agent to be used with amx,i will post again after i try the message via the controller

    Thanks again for your help
  • a_riot42a_riot42 Posts: 1,624
    You don't need absolutely need the user-agent header, it should work without it. I'll often use the name of the module with the version after. IE: AxisMod/1.1 or something similar. Either way, it isn't the source of your problem.
    Paul
  • msfayadmsfayad Posts: 18
    success

    thank you again for your reply .
    I have succeeded to send the string through Controller also through docklight client , I found the problem it was the soap massage format
    the right format is to send <CR><LF> after every line in HTTP HEADER
    and <CR><LF><CR><LF> in the end of the header
    but -and this was the wrong part i did before-you just have to send <LF> after every soap massage line not <CR><LF>
    ....
    my problem now is that the cam server closes the session after 5 sec may be so i have to open and close the socket after every massage which sometimes takes time (if you can imagine to send a massage to move right for ex. in push and a massage to stop in release it will be hard to open and close socket after every massage ) if you have a solution or idea how to handle this I will be very grateful

    MY BEST REGARDS
  • a_riot42a_riot42 Posts: 1,624
    msfayad wrote: »
    thank you again for your reply .
    I have succeeded to send the string through Controller also through docklight client , I found the problem it was the soap massage format
    the right format is to send <CR><LF> after every line in HTTP HEADER
    and <CR><LF><CR><LF> in the end of the header
    but -and this was the wrong part i did before-you just have to send <LF> after every soap massage line not <CR><LF>

    That hasn't been my experience, but different servers can operate differently I guess. I send an $0D,$0A after every line in the header and then $0D,$0A,$0D,$0A after the SOAP ACTION header to indicate the end of the headers. Then comes the SOAP envelope as the body of the message which is delimited with tags not EOL characters.
    msfayad wrote: »
    my problem now is that the cam server closes the session after 5 sec may be so i have to open and close the socket after every massage which sometimes takes time (if you can imagine to send a massage to move right for ex. in push and a massage to stop in release it will be hard to open and close socket after every massage ) if you have a solution or idea how to handle this I will be very grateful

    MY BEST REGARDS

    You don't have to close the socket, it will close when the server socket closes and sends its FIN message. You only have to reopen it to send another message. So far I haven't noticed any delay sending many messages. If you are trying to close an already closed socket, that might be causing a delay on its own and that is what you are seeing, hard to say.
    Paul
  • msfayadmsfayad Posts: 18
    i will try tomorrow

    i will try to do what you said tomorrow about not closing the socket and i'll post my results
  • msfayadmsfayad Posts: 18
    perfect

    I have completed the tasks I want.
    all I have done is to open the socket when I want to send and It closes after sending so I just need to check if the socket is open or not and if not I have to open it. just there was a function to save preset it has 2 messages BEGIN message and END message when I sent them after each other it didn't work I put a wait statement after sending the first message and it worked fine.-may be this action was due to the camera server_.

    Finally I Want To Say Thank you a_riot42 I really appreciate your help.
Sign In or Register to comment.