Connecting to the Rules Service via HTTP |
You can access the Rules Service via the HTTP protocol. The syntax of an HTTP command calling the Rules Service is: http://<host>:<port>/<application>/<user>/<ResponseType>/ <command>?$Password=<password>&CommandVariable where:
text%2Fhtml.
Sends the SQL SELECT statement defined in the $SQL variable to the Rules Service. Results in an HTML formatted table.
Start the SQL statement defined in the $SQL variable. This way, you can call a decision or a batch job, for example.
Invokes a method of an RDMI component. This component can be defined, or can be an internal component like the XML component.
http://<host>:<port>/<application>/<user>/<ResponseType>/<Component Name>.<Method Name>?$Password=<password>& arg1=Hello World
Example 1 This HTTP call invokes the internal XML component, and executes a query in XML format: http://localhost:7777/TRAVEL/TRAVELUSER/xml/xml.query?$Password=TrustMe&XmlDocument=<Query><Table Name="PERSON"></Table></Query> Example 2 This HTTP call starts a SQL statement inserting a record in the TOUR table, and then issues a commit: http://travelserver:4711/TRAVEL/TRAVELUSER/plain/SqlScript?$Password=TrustMe&$SQL=insert into TOUR values('MEXICO','DIVING',4,60);commit Example 3 This HTTP call starts the BenchMark Profiler by invoking the internal RulesEngine component: http://localhost:7777/TRAVEL/TRAVELUSER/plain/RulesEngine.RuleProfilerStart?$Password=TrustMe The resulting text is: "Profiler activated". You can stop the Profiler with HTTP call: http://localhost:7777/TRAVEL/TRAVELUSER/plain/RulesEngine.RuleProfilerStop?$Password=TrustMe with resulting text: "Rule profiler stopped successfully". NOTE: Only the Rules Engine through which the RuleProfilerStart command was issued will be profiled. You should ensure that this is the only Rules Engine under the RulesService that is running for the application that you wish to profile. Also make sure that you are the only user of the Rules Service during this test. For more information, refer to BenchMark help topic: "How to Make a Profile using the Stand-alone Profiler from Within Another Application". Example 4 This HTTP call retrieves an SVG Image from a CLOB field: the image must be recognized by the browser as SVG. To do this, use mime-type "image/svg+xml": http://localhost:7777/TRAVEL/TRAVELUSER /image%2Fsvg%2Bxml/SqlScript?$Password=TrustMe&$SQL=select%20DOCUMENT%20from%20SVGDOCUMENT%20where%20PK=2 Example 5 This example shows how to use the :$Content place holder It uses an ASP page calling a RulesService so that it can insert a record ('A', 'B') in the table TAB. This example uses the XMLHTTP object of the Microsoft XML Parser.: <OBJECT RUNAT=server PROGID=MSXML2.XMLHTTP id=xmlhttp></OBJECT> <% myxml = "<X><TAB COL1=""A"" COL2=""B""><Insert/></TAB></X>" myscript = "invoke xml.import with select :'$Content' XMLDocument; commit" urlrequest = "http://<server name>:<port nr>/<Application Name>/<UserName>/html/SqlScript?$Password=<Pwd>&$SQL=" & myscript xmlhttp.open "POST", urlrequest, False xmlhttp.send myxml response.ContentType = "text/xml" response.Write "<Result>" & xmlhttp.responseText & "</Result>" %> In this example, the content must be between quotes (") in order to build a correct SQL statement: for this reason the place holder is used with :'$Content'. Related Topics |