Facility Control

 View Only
  • 1.  Simple Object Access Protocol (SOAP)

    Posted 05-15-2019 18:08

    I'll preface this by saying I don't really know much about this at all. I'm looking at Teracue's Video Wall, and the controller can apparently take some basic commands (loading/changing presets) via something called SOAP.

    I have no documentation on what these commands are, or how to send them.... but would Ross Dashboard be capable of sending commands with that protocol? Would be great to have the possibility to integrate some controls into some buttons.



  • 2.  RE: Simple Object Access Protocol (SOAP)

    Posted 05-15-2019 18:24

    Hi Jake.

    SOAP messages are generally just snippets of XML sent over HTTP - so they should definitely be doable. Depending on the complexity of the message and whether or not you care about the response, it could be as simple as putting a little snippet of XML into a string and sending it as the 'data' argument in a call to ogscript.asyncPost. If you need to create sessions or manage responses, the complexity can grow.

    Here is an example panel done some time ago to demonstrate sending SOAP message and processing its response:

    <abs contexttype="opengear" id="_top" style="">
    <meta>
    <api>function parseSessionResponse(response)
    {
    if (response == null)
    {
    return;
    }

    var lookupKey = 'outputString&gt;';
    var index = response.indexOf(lookupKey);
    if (index &gt; 0)
    {
    response = response.substring(index + lookupKey.length, response.indexOf('&lt;', index)); //Grab everything in the "outputString" response tag
    ogscript.debug("GOT SESSION: " + response);
    ogscript.putObject("session_id", response);
    }
    else
    {
    ogscript.debug("NO RESPONSE FOUND");
    }

    }</api>
    <params>
    <param access="1" maxlength="0" name="Session URL" oid="Session_URL" type="STRING" value="" widget="text"/>
    <param access="1" maxlength="0" name="Login URL" oid="Login_URL" type="STRING" value="" widget="text"/>
    <param access="1" maxlength="0" name="Username" oid="username" type="STRING" value="" widget="text"/>
    <param access="1" maxlength="0" name="Password" oid="password" type="STRING" value="" widget="password"/>
    </params>
    </meta>
    <table height="176" left="36" top="41" width="468">
    <tr>
    <label colspan="1" fill="both" insets="2,2,2,2" name="URL: " rowspan="1" style="txt-align:east" weightx="0.0" weighty="1.0"/>
    <param colspan="1" expand="true" fill="both" insets="2,2,2,2" oid="Session_URL" rowspan="1" weightx="1.0" weighty="1.0"/>
    <button buttontype="push" colspan="1" fill="both" insets="2,2,2,2" name="Create Session" rowspan="1" weightx="0.0" weighty="1.0">
    <task tasktype="ogscript">var data = '&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hs="urn:VBrickWebSrvc"&gt;\n' +
    '&lt;soapenv:Body&gt;\n' +
    '&lt;hs:getNewSessionId&gt;\n' +
    '&lt;hs:inputstring&gt;encoder1&lt;/hs:inputstring&gt;\n' +
    '&lt;/hs:getNewSessionId&gt;\n' +
    '&lt;/soapenv:Body&gt;\n' +
    '&lt;/soapenv:Envelope&gt;';

    ogscript.asyncPost(params.getValue('Session_URL', 0), data, parseSessionResponse);</task>
    </button>
    </tr>
    <tr>
    <label colspan="1" fill="both" insets="2,2,2,2" name="URL: " rowspan="1" style="txt-align:east" weightx="0.0" weighty="1.0"/>
    <param colspan="1" expand="true" fill="both" insets="2,2,2,2" oid="Login_URL" rowspan="1" weightx="1.0" weighty="1.0"/>
    <button buttontype="push" colspan="1" fill="both" insets="2,2,2,2" name="Login" rowspan="3" weightx="0.0" weighty="1.0">
    <task tasktype="ogscript">var session = ogscript.getObject('session_id');
    var username = params.getValue('username', 0);
    var password = params.getValue('password', 0);
    var hash = ""; //NOT SURE WHAT YOU"RE USING TO HASH THE PASSWORD
    var data = "&lt;soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:hs=\"urn:VBrickWebSrvc\"&gt;\n &lt;soapenv:Body&gt;\n &lt;hs:login&gt;\n &lt;hs:sessionId&gt;" + session + "&lt;/hs:sessionId&gt;\n &lt;hs:loginName&gt;" + username + "&lt;/hs:loginName&gt;\n &lt;hs:loginHash&gt;" + hash+ "&lt;/hs:loginHash&gt;\n &lt;/hs:login&gt;\n &lt;/soapenv:Body&gt;\n&lt;/soapenv:Envelope&gt;\n";
    ogscript.asyncPost(params.getValue('Login_URL', 0), data, null); //We don't actually care about the response</task>
    </button>
    </tr>
    <tr>
    <label colspan="1" fill="both" insets="2,2,2,2" name="Login: " rowspan="1" style="txt-align:east" weightx="0.0" weighty="1.0"/>
    <param colspan="1" expand="true" fill="both" insets="2,2,2,2" oid="username" rowspan="1" weightx="1.0" weighty="1.0"/>
    </tr>
    <tr>
    <label colspan="1" fill="both" insets="2,2,2,2" name="Password: " rowspan="1" style="txt-align:east" weightx="0.0" weighty="1.0"/>
    <param colspan="1" expand="true" fill="both" insets="2,2,2,2" oid="password" rowspan="1" weightx="1.0" weighty="1.0"/>
    </tr>
    </table>
    <button buttontype="push" height="85" left="540" name="Sample Data" top="44" width="172">
    <task tasktype="ogscript">var sampleResponse = '&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:nss="urn:VBrickWebSrvc"&gt;\n' +
    ' &lt;SOAP-ENV:Body&gt;\n' +
    ' &lt;nss:getNewSessionIdResponse&gt;\n' +
    ' &lt;nss:outputString&gt;0000000009De4530&lt;/nss:outputString&gt;\n' +
    ' &lt;/nss:getNewSessionIdResponse&gt;\n' +
    ' &lt;/SOAP-ENV:Body&gt;\n' +
    '&lt;/SOAP-ENV:Envelope&gt;;';

    parseSessionResponse(sampleResponse);
    </task>
    </button>
    </abs>



    The key area is in the button's task where the SOAP message is built/sent:

    var session = ogscript.getObject('session_id');
    var username = params.getValue('username', 0);
    var password = params.getValue('password', 0);
    var hash = ""; //NOT SURE WHAT YOU"RE USING TO HASH THE PASSWORD
    var data = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:hs=\"urn:VBrickWebSrvc\">\n <soapenv:Body>\n <hs:login>\n <hs:sessionId>" + session + "</hs:sessionId>\n <hs:loginName>" + username + "</hs:loginName>\n <hs:loginHash>" + hash+ "</hs:loginHash>\n </hs:login>\n </soapenv:Body>\n</soapenv:Envelope>\n";
    ogscript.asyncPost(params.getValue('Login_URL', 0), data, null); //We don't actually care about the response

    #DashBoard