Wiki Page: 03 - How to Control the Corticon Server using Web Services Calls from Rollbase

Status
Not open for further replies.
M

mparish

Guest
NOTE: This functionality has now been implemented in Corticon 5.5 Corticon Server Admin Functions All of the Corticon Admin functions are available as web service calls. You can find all the WSDL here in the server console You could import the WSDL into SOAP UI for a quick way to run them. Here’s a screenshot and the SOAP UI project So you could manage just about everything by making web services calls if you wanted to. GetCcServerInfo SOAP Request SOAP Response Accomplishing this from Rollbase You will need to set up an object script for each different call you want to make to CorticonAdmin. Test Connection to Server var xmlRequest= " soapenv:Envelope " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " + "xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " + "xmlns:soap=\"http://soap.eclipse.corticon.com\" " + " soapenv:Header/ " + " soapenv:Body " + " soap:testConnectionToServer soapenv:encodingStyle=\'http://schemas.xmlsoap.org/soap/encoding/\'/ ' + ' /soapenv:Body ' + ' /soapenv:Envelope ' ; var url = '{!server_url}/axis/services/CorticonAdmin'; /* substitute server URL**/ var params = {'SOAPAction':'http://soap.eclipse.corticon.com','Content-Type':'text/xml'}; var response= rbv_api.sendJSONRequest(url,xmlRequest,'POST','text/xml;charset:UTF-8',null,null,params); rbv_api.println(response); var root = rbv_api.parseXML(response); var serverStatus= root.getElementsByTagName('testConnectionToServerReturn').item(0).getFirstChild().getNodeValue(); rbv_api.println(serverStatus); rbv_api.setFieldValue('corticon_server', {!id}, 'status',serverStatus); Get CcPropertyValue (max loops) var xmlRequest= " soapenv:Envelope " + "xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " + "xmlns:soap=\"http://soap.eclipse.corticon.com\" " + " soapenv:Header/ " + " soapenv:Body " + " soap:getCcPropertyValue " + " astrProperty com.corticon.reactor.rulebuilder.maxloops /astrProperty " + " /soap:getCcPropertyValue " + " /soapenv:Body " + " /soapenv:Envelope "; var url = "{!server_url}/axis/services/CorticonAdmin"; /* from record */ var params = {"SOAPAction":"http://soap.eclipse.corticon.com","Content-Type":"text/xml"}; var response= rbv_api.sendJSONRequest(url,xmlRequest,"POST","text/xml;charset:UTF-8",null,null,params); rbv_api.println(response); var root = rbv_api.parseXML(response); var maxLoops = root.getElementsByTagName('getCcPropertyValueReturn').item(0).getFirstChild().getNodeValue(); rbv_api.println(maxLoops); rbv_api.setFieldValue('corticon_server', {!id}, 'max_loops',maxLoops); getCcServerInfo /********************* CONSTRUCT SOAP MESSAGE FOR getCcServerInfo *********/ var xmlRequest= " soapenv:Envelope " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " + "xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " + "xmlns:soap=\"http://soap.eclipse.corticon.com\" " + " soapenv:Header/ " + " soapenv:Body " + " soap:getCcServerInfo soapenv:encodingStyle=\'http://schemas.xmlsoap.org/soap/encoding/\'/ ' + ' /soapenv:Body ' + ' /soapenv:Envelope ' ; /********************* CALL CORTICONADMIN VIA WEB SERVICE *****************/ var url = '{!server_url}/axis/services/CorticonAdmin'; /* hardcoded URL for testing**/ var params = {'SOAPAction':'http://soap.eclipse.corticon.com','Content-Type':'text/xml'}; var response= rbv_api.sendJSONRequest(url,xmlRequest,'POST','text/xml;charset:UTF-8',null,null,params); /*rbv_api.println(response);*/ /********************* CONVERT XML FROM &gt &lt to ********************/ var root = rbv_api.parseXML(response); var xml= root.getElementsByTagName('getCcServerInfoReturn').item(0).getFirstChild().getNodeValue(); /*rbv_api.println(xml);*/ /********************* EXTRACT NAME VALUE PAIRS FROM LICENSE *************/ var license = rbv_api.evalXpath(xml, '//LicenseProperty'); for (var k=0; k license.length; k++) { rbv_api.println('Result: '+license.item(k).getAttributes().getNamedItem('name')); rbv_api.println('Result: '+license.item(k).getAttributes().getNamedItem('value'));}

Continue reading...
 
Status
Not open for further replies.
Top