DynamicESDL_Includer.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
  4. <book lang="en_US" xml:base="../">
  5. <bookinfo>
  6. <title>Dynamic ESDL</title>
  7. <mediaobject>
  8. <imageobject>
  9. <imagedata fileref="images/redswooshWithLogo3.jpg" />
  10. </imageobject>
  11. </mediaobject>
  12. <author>
  13. <surname>Boca Raton Documentation Team</surname>
  14. </author>
  15. <legalnotice>
  16. <para>We welcome your comments and feedback about this document via
  17. email to <email>docfeedback@hpccsystems.com</email></para>
  18. <para>Please include <emphasis role="bold">Documentation
  19. Feedback</emphasis> in the subject line and reference the document name,
  20. page numbers, and current Version Number in the text of the
  21. message.</para>
  22. <para>LexisNexis and the Knowledge Burst logo are registered trademarks
  23. of Reed Elsevier Properties Inc., used under license.</para>
  24. <para>HPCC Systems<superscript>®</superscript> is a registered trademark
  25. of LexisNexis Risk Data Management Inc.</para>
  26. <para>Other products, logos, and services may be trademarks or
  27. registered trademarks of their respective companies.</para>
  28. <para>All names and example data used in this manual are fictitious. Any
  29. similarity to actual persons, living or dead, is purely
  30. coincidental.</para>
  31. <para></para>
  32. </legalnotice>
  33. <xi:include href="common/Version.xml"
  34. xpointer="xpointer(//*[@id='FooterInfo'])"
  35. xmlns:xi="http://www.w3.org/2001/XInclude" />
  36. <xi:include href="common/Version.xml"
  37. xpointer="xpointer(//*[@id='DateVer'])"
  38. xmlns:xi="http://www.w3.org/2001/XInclude" />
  39. <corpname>HPCC Systems<superscript>®</superscript></corpname>
  40. <xi:include href="common/Version.xml"
  41. xpointer="xpointer(//*[@id='Copyright'])"
  42. xmlns:xi="http://www.w3.org/2001/XInclude" />
  43. <mediaobject role="logo">
  44. <imageobject>
  45. <imagedata fileref="images/LN_Rightjustified.jpg" />
  46. </imageobject>
  47. </mediaobject>
  48. </bookinfo>
  49. <chapter>
  50. <title>Dynamic ESDL</title>
  51. <para>Dynamic ESDL (Enterprise Service Description Language) is a
  52. methodology that helps you develop and manage web-based query interfaces
  53. quickly and consistently.</para>
  54. <para>Dynamic ESDL takes an interface-first development approach. It
  55. leverages the ESDL Language to create a common interface “contract” that
  56. both Roxie Query and Web interface developers will adhere to. It is
  57. intended to allow developers to create production web services, with clean
  58. interfaces that can evolve and grow over time without breaking existing
  59. applications.</para>
  60. <para>ESDL’s built-in versioning support helps ensure compiled and
  61. deployed applications continue to operate while changes are made to the
  62. deployed service’s interface for new functionality.</para>
  63. <para>ESDL’s ability to define and reuse common structures helps maintain
  64. consistent interfaces across methods.</para>
  65. <para>The Dynamic ESDL service is built to scale horizontally, and hooks
  66. are provided to add custom logging and security to help create fully
  67. “productionalized” web services.</para>
  68. <para>Once a service is deployed, application developers and end-users can
  69. consume the service using REST, JSON, XML, SOAP, or form encoded posts.
  70. Dynamic ESDL provides quick and easy access to a WSDL, live forms, sample
  71. requests and responses, and testing interfaces to allow developers to test
  72. logic changes, data changes, or new features, as well as to interact with
  73. the service directly using SOAP, XML, or JSON.</para>
  74. </chapter>
  75. <chapter id="DESDLWorkflowTutorial">
  76. <title>Workflow Tutorial</title>
  77. <sect1 id="DESDLWorkflowOverview" role="nobrk">
  78. <title>Overview</title>
  79. <para>In this section, we will:</para>
  80. <para></para>
  81. <itemizedlist>
  82. <listitem>
  83. <para>Use Configuration Manager to add a Dynamic ESDL-based ESP
  84. Service and bind it to a port on an ESP server.</para>
  85. <para></para>
  86. </listitem>
  87. <listitem>
  88. <para>Write an ESDL Service Definition.</para>
  89. <para></para>
  90. </listitem>
  91. <listitem>
  92. <para>Generate ECL from the ESDL Service Definition, copy it to your
  93. ECL repository, and the write the ECL query that will deliver the
  94. result (the business logic).</para>
  95. <para></para>
  96. </listitem>
  97. <listitem>
  98. <para>Compile the ECL business logic query and publish it to a Roxie
  99. cluster.</para>
  100. <para>At this point you can test the query using WsECL.</para>
  101. <para></para>
  102. </listitem>
  103. <listitem>
  104. <para>Publish the Dynamic ESDL definition.</para>
  105. <para></para>
  106. </listitem>
  107. <listitem>
  108. <para>Bind the service methods to the Roxie queries using a
  109. configuration XML file.</para>
  110. <para></para>
  111. </listitem>
  112. </itemizedlist>
  113. <para><emphasis role="bold">DESDL and LDAP Security</emphasis></para>
  114. <para>If your HPCC platform is configured to use LDAP security, you must
  115. ensure any user who will be publishing ESDL Definitions has Access to
  116. <emphasis role="bold">ESDL configuration service</emphasis> set to
  117. <emphasis role="bold">Allow Full</emphasis>, as shown below.</para>
  118. <para><graphic fileref="images/desdl-LDAP.jpg" /></para>
  119. <para></para>
  120. <para></para>
  121. </sect1>
  122. <sect1 id="DESDLConfigureAndBind">
  123. <title>Configure and Bind a Dynamic ESDL service</title>
  124. <para>This step adds an ESP service and a service binding that reserves
  125. a port for the dynamic ESDL service. This step is independent of the
  126. development and publishing of the actual Roxie query, so you can set it
  127. up before or after your query is ready.</para>
  128. <orderedlist>
  129. <listitem>
  130. <para>If it is running, stop the HPCC system, using this
  131. command:</para>
  132. <para><emphasis role="bold">Centos/Red Hat</emphasis>
  133. <programlisting>sudo /sbin/service hpcc-init stop</programlisting></para>
  134. <para><emphasis role="bold">Ubuntu</emphasis></para>
  135. <para><programlisting>sudo service hpcc-init stop</programlisting></para>
  136. <para><emphasis role="bold">Debian 6 (Squeeze)</emphasis></para>
  137. <programlisting>sudo /etc/init.d/hpcc-init stop</programlisting>
  138. <para><informaltable colsep="1" frame="all" rowsep="1">
  139. <?dbfo keep-together="always"?>
  140. <tgroup cols="2">
  141. <colspec colwidth="49.50pt" />
  142. <colspec />
  143. <tbody>
  144. <row>
  145. <entry><inlinegraphic
  146. fileref="images/OSSgr3.png" /></entry>
  147. <entry>You can use this command to confirm HPCC processes
  148. are stopped (on Centos/Red Hat):<para> <programlisting>sudo /sbin/service hpcc-init status</programlisting>
  149. <phrase>For Ubuntu</phrase> <programlisting>sudo service hpcc-init status
  150. </programlisting> <phrase>For Debian 6 (Squeeze)</phrase> <programlisting>sudo /etc/init.d/hpcc-init status</programlisting>
  151. </para></entry>
  152. </row>
  153. </tbody>
  154. </tgroup>
  155. </informaltable></para>
  156. </listitem>
  157. <listitem>
  158. <para>Start the Configuration Manager service.<emphasis
  159. role="bold"></emphasis><programlisting>sudo /opt/HPCCSystems/sbin/configmgr
  160. </programlisting></para>
  161. </listitem>
  162. <listitem>
  163. <para>Using a Web browser, go to the Configuration Manager's
  164. interface:</para>
  165. <programlisting>http://&lt;<emphasis>node ip </emphasis>&gt;:8015</programlisting>
  166. <para>The Configuration Manager startup wizard displays.</para>
  167. </listitem>
  168. <listitem>
  169. <?dbfo keep-together="always"?>
  170. <para>Select <emphasis role="bold">Advanced View</emphasis> and then
  171. select the source environment XML file to edit.</para>
  172. <para><graphic fileref="images/desdl-openconfig.jpg" /></para>
  173. </listitem>
  174. <listitem>
  175. <para>Press the <emphasis role="bold">Next</emphasis> button.</para>
  176. </listitem>
  177. <listitem>
  178. <para>Right-click on <emphasis role="bold">Esp Services</emphasis>
  179. and select <emphasis role="bold">New Esp Services</emphasis> &gt;
  180. <emphasis role="bold">Dynamic ESDL</emphasis>.</para>
  181. <para><graphic fileref="images/desdl-addDESDL.jpg" /></para>
  182. </listitem>
  183. <listitem>
  184. <?dbfo keep-together="always"?>
  185. <para>Provide a name for the service.</para>
  186. <para><graphic fileref="images/dsdl-NametheService.jpg" /></para>
  187. </listitem>
  188. <listitem>
  189. <?dbfo keep-together="always"?>
  190. <para>Select your ESP , then select the ESP Service Bindings
  191. tab.</para>
  192. <para><graphic fileref="images/desdl-ESPSVCBinding.jpg" /></para>
  193. </listitem>
  194. <listitem>
  195. <?dbfo keep-together="always"?>
  196. <para>Right-click in the list of bindings and select <emphasis
  197. role="bold">Add</emphasis></para>
  198. <para><graphic fileref="images/desdl-AddSVCBinding.jpg" /></para>
  199. </listitem>
  200. <listitem>
  201. <para>Provide a name, port, and then select the service. The service
  202. definition you added will display in the list of available
  203. services.</para>
  204. <para><graphic fileref="images/desdl-NameSVCBinding.jpg" /></para>
  205. </listitem>
  206. <listitem>
  207. <para>Copy the NewEnvironment.xml file from the source directory to
  208. the /etc/HPCCSystems and rename the file to environment.xml</para>
  209. <programlisting># for example
  210. sudo cp /etc/HPCCSystems/source/NewEnvironment.xml /etc/HPCCSystems/environment.xml</programlisting>
  211. <para><informaltable colsep="1" frame="all" rowsep="1">
  212. <?dbfo keep-together="always"?>
  213. <tgroup cols="2">
  214. <colspec colwidth="49.50pt" />
  215. <colspec />
  216. <tbody>
  217. <row>
  218. <entry><inlinegraphic
  219. fileref="images/caution.png" /></entry>
  220. <entry>Make sure that you have sufficient privileges to
  221. write file(s) to the destination directory before
  222. attempting to copy. If prompted to overwrite the
  223. destination file, you should answer <emphasis
  224. role="bold">yes</emphasis>.</entry>
  225. </row>
  226. </tbody>
  227. </tgroup>
  228. </informaltable></para>
  229. </listitem>
  230. <listitem>
  231. <para>Copy the <emphasis
  232. role="bold">/etc/HPCCSystems/environment.xml</emphasis> to <emphasis
  233. role="bold">/etc/HPCCSystems/</emphasis> on <emphasis
  234. role="bold">every</emphasis> node.</para>
  235. <para>You may want to create a script to push out the XML file to
  236. all nodes. A sample script is provided with HPCC. The following
  237. command copies the XML files out to all nodes as required:</para>
  238. <para><programlisting>sudo /opt/HPCCSystems/sbin/hpcc-push.sh &lt;sourcefile&gt; &lt;destinationfile&gt;
  239. </programlisting></para>
  240. </listitem>
  241. <listitem>
  242. <?dbfo keep-together="always"?>
  243. <para>Restart the HPCC system on <emphasis
  244. role="bold">every</emphasis> node. The following command starts the
  245. HPCC system on an individual node:</para>
  246. <para><emphasis role="bold">Centos/Red Hat</emphasis>
  247. <programlisting>sudo /sbin/service hpcc-init start</programlisting></para>
  248. <para><emphasis role="bold">Ubuntu</emphasis></para>
  249. <para><programlisting>sudo service hpcc-init start</programlisting></para>
  250. <para><emphasis role="bold">Debian 6 (Squeeze)</emphasis></para>
  251. <programlisting>sudo /etc/init.d/hpcc-init start</programlisting>
  252. <para></para>
  253. <informaltable colsep="1" frame="all" rowsep="1">
  254. <?dbfo keep-together="always"?>
  255. <tgroup cols="2">
  256. <colspec colwidth="49.50pt" />
  257. <colspec />
  258. <tbody>
  259. <row>
  260. <entry><inlinegraphic fileref="images/OSSgr3.png" /></entry>
  261. <entry><para>You may want to create a script to push this
  262. command out to every node. A sample script is provided with
  263. HPCC. Use the following command to start HPCC on all
  264. nodes:</para> <para> <programlisting>sudo /opt/HPCCSystems/sbin/hpcc-run.sh -a hpcc-init start</programlisting>
  265. </para></entry>
  266. </row>
  267. </tbody>
  268. </tgroup>
  269. </informaltable>
  270. <para></para>
  271. </listitem>
  272. </orderedlist>
  273. </sect1>
  274. <sect1 id="DESDLWriteDef">
  275. <title>Write the ESDL Service Definition</title>
  276. <para>In this section, we will write a the Service Definitions. The
  277. program listing below shows a service called
  278. <emphasis>MathService</emphasis>. It contains one method,
  279. <emphasis>AddThis</emphasis>, with a simple request and a simple
  280. response defined.</para>
  281. <programlisting>ESPservice MathService
  282. {
  283. ESPmethod AddThis(AddThisRequest, AddThisResponse);
  284. };
  285. ESPrequest AddThisRequest
  286. {
  287. int FirstNumber;
  288. int SecondNumber;
  289. };
  290. ESPresponse AddThisResponse
  291. {
  292. int Answer;
  293. };
  294. </programlisting>
  295. <orderedlist>
  296. <listitem>
  297. <para>Save the file as MathService.ecm.</para>
  298. <para></para>
  299. </listitem>
  300. </orderedlist>
  301. </sect1>
  302. <sect1 id="DESDLGenerateDefs">
  303. <title>Generate ECL definitions from the ESDL Service Definition</title>
  304. <para>In this section, we will generate ECL from this ESDL Service
  305. Definition file. This will use the esdl executable that is installed
  306. with Client Tools.</para>
  307. <para>You will find this in C:\Program Files
  308. (x86)\HPCCSystems\5.2.0\clienttools\bin on a Windows machine</para>
  309. <para>or /opt/HPCCSystems/bin/ on a Linux machine.</para>
  310. <para><orderedlist>
  311. <listitem>
  312. <para>From the command line, run:</para>
  313. <para><programlisting>esdl ecl MathService.ecm .</programlisting>This
  314. produces a file named MathService.ecl in the current
  315. directory</para>
  316. <programlisting><emphasis role="green">/*** Not to be hand edited (changes will be lost on re-generation) ***/
  317. /*** ECL Interface generated by esdl2ecl version 1.0 from MathService.xml. ***/
  318. /*===================================================*/</emphasis>
  319. export MathService := MODULE
  320. export t_AddThisRequest := record
  321. integer FirstNumber {xpath('FirstNumber')};
  322. integer SecondNumber {xpath('SecondNumber')};
  323. end;
  324. export t_AddThisResponse := record
  325. integer Answer {xpath('Answer')};
  326. end;
  327. end;
  328. <emphasis role="green">/*** Not to be hand edited (changes will be lost on re-generation) ***/
  329. /*** ECL Interface generated by esdl2ecl version 1.0 from MathService.xml. ***/
  330. /*===================================================*/</emphasis>
  331. </programlisting>
  332. <para></para>
  333. </listitem>
  334. <listitem>
  335. <para>Copy the MathService.ecl file to a module in your ECL
  336. Repository. For example, myMathService.</para>
  337. </listitem>
  338. <listitem>
  339. <para>Write ECL to support the service:</para>
  340. <programlisting>IMPORT MyMathService;
  341. rec_in := MyMathService.MathService.t_AddThisRequest;
  342. First_Row := ROW ([], rec_in) : STORED ('AddThisRequest', FEW);
  343. c:= first_row.FirstNumber + first_row.SecondNumber;
  344. ds_out := ROW ({c},MyMathService.MathService.t_AddThisResponse);
  345. OUTPUT(ds_out, NAMED('AddThisResponse')); </programlisting>
  346. </listitem>
  347. <listitem>
  348. <para>Compile and Publish to your Roxie cluster.</para>
  349. </listitem>
  350. <listitem>
  351. <para>Test the service using WsECL :<programlisting>http://&lt;<emphasis>node ip </emphasis>&gt;:8002 </programlisting></para>
  352. </listitem>
  353. </orderedlist></para>
  354. </sect1>
  355. <sect1 id="DESDLPublishandBind">
  356. <title>Publish the ESDL Service Definitions and Bind the ESDL
  357. Service</title>
  358. <para>In this section, we will publish the ESDL Service definitions to
  359. the System Data Store and bind the methods to he published Roxie
  360. query.</para>
  361. <para><orderedlist>
  362. <listitem>
  363. <para>Publish the Dynamic ESDL definition</para>
  364. <programlisting>esdl publish MathService MathService.ecm -s nnn.nnn.nnn.nnn -p 8010 --version 1</programlisting>
  365. <para>Replace nnn.nnn.nnn.nnn with your ECL Watch ESP server's IP
  366. address.</para>
  367. </listitem>
  368. <listitem>
  369. <para>Create the configuration XML file</para>
  370. <programlisting>&lt;Methods&gt;
  371. &lt;Method name="AddThis" url="&lt;RoxieIPRange&gt;:9876" querytype="roxie" queryname="AddThis"&gt;
  372. &lt;!--Optional Method Context Information start--&gt;
  373. &lt;Gateways&gt;
  374. &lt;Gateway name="mygateway" url="1.1.1.1:2222/someservice/somemethod/&gt;
  375. &lt;Gateway name="anothergateway" url="2.2.2.2:9999/someservice/somemethod/&gt;
  376. &lt;/Gateways&gt;
  377. &lt;!--Optional Method Context Information end--&gt;
  378. &lt;/Method&gt;
  379. &lt;/Methods&gt;</programlisting>
  380. <para>Where name is the name of your method(s) and url is the
  381. Roxie server's IP address and port, finally queryname is the
  382. published name (alias) of the query. For a multi-node Roxie, you
  383. can use a range in the form of nnn.nnn.nnn.n-nnn. The ESP
  384. schedules requests to the target Roxie in a round-robin
  385. fashion.</para>
  386. <para>Optionally, your method could include context information as
  387. illustrated in the above example. The context information should
  388. be formated such that it is consumable by the target ECL query.
  389. The HPCC DESDL ESP does not impose any restrictions on the context
  390. information passed in the configuration file other than it must be
  391. valid XML.</para>
  392. <!-- /* Refer to DESDL XML Configurations? */ Ex. For more information on XXXX see XXXX.-->
  393. </listitem>
  394. <listitem>
  395. <para>Save the file as MathSvcCfg.xml</para>
  396. </listitem>
  397. <listitem>
  398. <para>Bind the service methods to the queries using a the
  399. configuration XML.</para>
  400. <programlisting>esdl bind-service myesp 8003 MathService.1 MathService --config MathSvcCfg.xml
  401. -s nnn.nnn.nnn.nnn -p 8010
  402. </programlisting>
  403. <para>Where myesp is the name of your ESP process, 8003 is the
  404. port you reserved for your Dynamic ESDL service.</para>
  405. <para></para>
  406. </listitem>
  407. <listitem>
  408. <para>Test the service using the new interface:<programlisting>http://&lt;<emphasis>node ip </emphasis>&gt;:8003</programlisting></para>
  409. </listitem>
  410. </orderedlist></para>
  411. </sect1>
  412. </chapter>
  413. <xi:include href="HPCCClientTools/CT_Mods/CT_ESDL_CLI.xml"
  414. xpointer="xpointer(//*[@id='ESDL_CLI'])"
  415. xmlns:xi="http://www.w3.org/2001/XInclude" />
  416. <!-- Moved the ESDL Language Reference to a separate book -->
  417. </book>