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>';
var index = response.indexOf(lookupKey);
if (index > 0)
{
response = response.substring(index + lookupKey.length, response.indexOf('<', 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 = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hs="urn:VBrickWebSrvc">\n' +
'<soapenv:Body>\n' +
'<hs:getNewSessionId>\n' +
'<hs:inputstring>encoder1</hs:inputstring>\n' +
'</hs:getNewSessionId>\n' +
'</soapenv:Body>\n' +
'</soapenv:Envelope>';
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 = "<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</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 = '<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">\n' +
' <SOAP-ENV:Body>\n' +
' <nss:getNewSessionIdResponse>\n' +
' <nss:outputString>0000000009De4530</nss:outputString>\n' +
' </nss:getNewSessionIdResponse>\n' +
' </SOAP-ENV:Body>\n' +
'</SOAP-ENV:Envelope>;';
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