No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0244.xml 41KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>IO Data</title>
  10. <abstract>This specification defines an XMPP protocol extension for handling the input to and output from a remote entity.</abstract>
  11. &LEGALNOTICE;
  12. <number>0244</number>
  13. <status>Deferred</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. <spec>XEP-0001</spec>
  20. <spec>XEP-0030</spec>
  21. <spec>XEP-0050</spec>
  22. </dependencies>
  23. <supersedes/>
  24. <supersededby/>
  25. <shortname>NOT_YET_ASSIGNED</shortname>
  26. <author>
  27. <firstname>Johannes</firstname>
  28. <surname>Wagener</surname>
  29. <email>johannes.wagener@med.uni-muenchen.de</email>
  30. <jid>edrin@jabber.org</jid>
  31. </author>
  32. <author>
  33. <firstname>Egon</firstname>
  34. <surname>Willighagen</surname>
  35. <email>egonw@users.sf.net</email>
  36. <jid>egonw@jabber.org</jid>
  37. </author>
  38. <author>
  39. <firstname>Andreas</firstname>
  40. <surname>Heusler</surname>
  41. <email>aheusler@in.tum.de</email>
  42. <jid>krach@jabber.org</jid>
  43. </author>
  44. <author>
  45. <firstname>Tobias</firstname>
  46. <surname>Markmann</surname>
  47. <email>tm@ayena.de</email>
  48. <jid>tm@ayena.de</jid>
  49. </author>
  50. <author>
  51. <firstname>Ola</firstname>
  52. <surname>Spjuth</surname>
  53. <email>ola.spjuth@farmbio.uu.se</email>
  54. <jid>olas@pele.farmbio.uu.se</jid>
  55. </author>
  56. <revision>
  57. <version>0.1</version>
  58. <date>2008-06-18</date>
  59. <initials>psa</initials>
  60. <remark><p>Initial published version.</p></remark>
  61. </revision>
  62. <revision>
  63. <version>0.0.4</version>
  64. <date>2008-06-05</date>
  65. <initials>jw/ew</initials>
  66. <remark><p>The IO Data specific commands (procedure status and output request) were moved in the IO Data namespace. The Schema was adapted to become extensible.</p></remark>
  67. </revision>
  68. <revision>
  69. <version>0.0.3</version>
  70. <date>2008-04-16</date>
  71. <initials>jw</initials>
  72. <remark><p>Applied the suggested modifications in result to the discussion on the XMPP standards mailing list.</p></remark>
  73. </revision>
  74. <revision>
  75. <version>0.0.2</version>
  76. <date>2008-03-20</date>
  77. <initials>jw</initials>
  78. <remark><p>Added some missing namespaces in two examples.</p></remark>
  79. </revision>
  80. <revision>
  81. <version>0.0.1</version>
  82. <date>2008-02-25</date>
  83. <initials>jw</initials>
  84. <remark><p>Initial Version.</p></remark>
  85. </revision>
  86. </header>
  87. <section1 topic='Introduction' anchor='intro'>
  88. <section2 topic='About the intention to write this XEP' anchor='intention'>
  89. <p>&xep0050; became a popular and widespread XMPP Protocol Extension to execute functions on a remote systems. It is supported by many XMPP client and service implementations. To date almost all of its implementations rely on &xep0004; to be the data container. However Ad-Hoc Commands is explicitly designed and mentioned to be used in combination with other data containers, too. This applies for the cases where the Data Forms specification does not fit the needs, for example the Data Forms can be too restrictive on strong typing of data (see Section 1.2).</p>
  90. <p>The intention of the present XEP is to define a data container for the cases where Data Forms is not applicable or not optimal. The data container defined herein (IO Data) is very generic and discoverable. It is intended to be used for other purposes than Data Forms.</p>
  91. </section2>
  92. <section2 topic='Limitations of Data Forms' anchor='limits'>
  93. <p>The Data Forms data container has certain restrictive limitations:</p>
  94. <ol>
  95. <li>The supported Field Types are limited: text input fields, drop down boxes, different selectable optional values, etc. See <link url='http://www.xmpp.org/extensions/xep-0004.html#protocol-fieldtypes'>Data Forms - Field Types</link></li>
  96. <li>The only allowed content type of the fields is xs:string. See <link url='http://www.xmpp.org/extensions/xep-0004.html#schema'>Data Forms - XML Schema</link></li>
  97. <li>According to current specifications it is not possible to transport complex tree-based data structures. For example nested elements of elements cannot have nested elements at all, therefore lacking an XML key feature.</li>
  98. </ol>
  99. <p>The limitations of Data Forms are not bad. They are good for the special use case a client has to render a graphical representation of the service. In HTML the correlative is a HTML form. For a chat client developer this makes it plain and simple to develop a generic graphical client implementation with some simple text-input fields.</p>
  100. </section2>
  101. <section2 topic='Why an additional data container is required' anchor='sense'>
  102. <p>According to current standards it is not supported to encapsulate more complex data in the Data Forms data container. For example it is not possible to encapsulate a complete XML Document - the real "generic" data container - in the Data Forms data container, unless you encode the XML Document as xs:string – which would be considered bad practice.</p>
  103. <p>However specialized clients are developed to make use of the service oriented architecture of XMPP. An example is given here: a XMPP client implementation reflects an Application Programming Interface (API) with an XMPP services by making use of Ad-Hoc Commands.</p>
  104. <example caption='get_titles.js'><![CDATA[
  105. // javascript syntax
  106. service = client.getService("database.server.com");
  107. function = service.getFunction("getXmlFile");
  108. // Check if this Ad-Hoc Command supports the IO Data XEP?
  109. if (function instanceof IoDataFunction) {
  110. // Discover the input and output XML Schemata - required only once!
  111. schemata = function.getIoSchemata();
  112. // Dynamically marshal an API for the input and output - required only once!
  113. inputOutputFactory = new IoFactory( schemata );
  114. // Create and set the input
  115. input1 = inputOutputFactory.createInputObject();
  116. input1.setFileName("doc-ID-011021");
  117. // Invoke the function and get the output
  118. result1 = function.invoke(input1);
  119. output1 = inputOutputFactory.getOutputObject(result1);
  120. title1 = output1.getDocumentTitle();
  121. // Next document
  122. input2 = inputOutputFactory.createInputObject();
  123. input2.setFileName("doc-ID-833423");
  124. result2 = function.invoke(input2);
  125. output2 = inputOutputFactory.getOutputObject(result2);
  126. title2 = output1.getDocumentTitle();
  127. ...
  128. }]]></example>
  129. <p>The limitations of Data Forms make it impossible to define and handshake these actions clearly and precisely and without confusing existing and future implementations for the following reasons:</p>
  130. <ol>
  131. <li>Data Forms does not support a "Schemata Discovery". The form descriptor Data Forms provides (type='form') is not separated from the data transaction according to the Ad-Hoc Command logic descibed in XEP-0050. Therefore each function invocation would result in a form descriptor submission again causing unnecessary traffic. It is sufficient to discover the IO Schemata once.</li>
  132. <li>It is not suggested to encapsulate XML Documents in the Data Forms in general.</li>
  133. </ol>
  134. </section2>
  135. <section2 topic='Web Services over XMPP' anchor='ws'>
  136. <p>Beside Ad-Hoc Commands two other XEPs exist that provide mechanisms to execute a function on a remote system. For this count &xep0009; and &xep0072;.</p>
  137. <p>However, Jabber-RPC and SOAP over XMPP lack certain functionality that is important for flexible, simple and robust Web Services. Because of the limited expressiveness of XML-RPCs data types the Jabber-RPC is not suitable for complex functionality, similar to the limitations of Data Forms. While SOAP over XMPP supports complex data types it lacks an obvious mechanism for asynchronous usage. For example it has no default stateful design: there is no sessionid like in Ad-Hoc Commands. Beside this SOAP brings in severe complexity (XML associated abstractions) that was required for the primary transport layer HTTP. This complexity is not required because XMPP does already implement the required XML associated abstractions. In addition to that there are other issues that argument against SOAP. For example to date most HTTP SOAP implemented services are only compatible with a subset of SOAP libraries.</p>
  138. <p>In contrast Ad-Hoc Commands comprises simple, clean and optionally stateful Web Service mechanisms by default. In addition to that asynchronous client notification can be achieved with a &lt;message&gt;, as indicated in Ad-Hoc Commands and as realized in some unofficial implementations.</p>
  139. </section2>
  140. <section2 topic='The IO Data data container' anchor='conclusion'>
  141. <p>In conclusion and as already suggested in Ad-Hoc Commands we describe an alternative data container. This data container is more generic in the way it can be used:</p>
  142. <ol>
  143. <li>It supports a "Schemata Discovery". Thus a client implementation can marshal an API for the input and output (and optionally for a service specific error) of a certain service.</li>
  144. <li>This "Schemata Discovery" is separated from the data transaction. This reduces the amount of unnecessary traffic.</li>
  145. <li>The Field Types of the described data container are on the one hand clearly defined (there is only description, input, output, error, and status) and on the other hand straightforward. Thus any kind of XML data (XML Document with namespaces that represent any imaginable data object) can be submitted.</li>
  146. </ol>
  147. <p>It is important to note that this XEP does not intent to replace or extent Data Forms. Also it does not break any current Ad-Hoc implementations. It just intends to offer another data container that fits much better under some circumstances where no GUI is rendered around an Ad-Hoc Command service.</p>
  148. </section2>
  149. </section1>
  150. <section1 topic='Protocol' anchor='protocol'>
  151. <p>The base syntax for the 'urn:xmpp:tmp:io-data' namespace is as follows &NSNOTE;; a formal description can be found in the XML Schema section below.</p>
  152. <code><![CDATA[
  153. <iodata xmlns='urn:xmpp:tmp:io-data'
  154. type='transaction-type'>
  155. <desc/>
  156. <in/>
  157. <out/>
  158. <error/>
  159. <status>
  160. <elapsed/>
  161. <remaining/>
  162. <percentage/>
  163. <information/>
  164. </status>
  165. </iodata>
  166. ]]></code>
  167. <section2 topic='Transaction Types' anchor='trans'>
  168. <table caption='IO Data Transaction Types allowed for client to service stanzas'>
  169. <tr>
  170. <th>Transaction Type</th>
  171. <th>Purpose</th>
  172. <th>Associated Ad-Hoc Command</th>
  173. <th>REQUIRED for generic XEP compatibility</th>
  174. <th>Contained Elements</th>
  175. </tr>
  176. <tr>
  177. <th>io-schemata-get</th>
  178. <th>To request the schemata of input and output.</th>
  179. <th>execute</th>
  180. <th>yes</th>
  181. <th>-</th>
  182. </tr>
  183. <tr>
  184. <th>input</th>
  185. <th>To submit the input.</th>
  186. <th>execute</th>
  187. <th>yes</th>
  188. <th>&lt;in&gt;</th>
  189. </tr>
  190. <tr>
  191. <th>getStatus</th>
  192. <th>To request the status of the procedure.</th>
  193. <th>next</th>
  194. <th>yes</th>
  195. <th>-</th>
  196. </tr>
  197. <tr>
  198. <th>getOutput</th>
  199. <th>To request the output.</th>
  200. <th>next, complete</th>
  201. <th>yes</th>
  202. <th>-</th>
  203. </tr>
  204. </table>
  205. <table caption='IO Data Transaction Types allowed for service to client stanzas'>
  206. <tr>
  207. <th>Transaction Type</th>
  208. <th>Purpose</th>
  209. <th>Associated Ad-Hoc Command status value</th>
  210. <th>REQUIRED for generic XEP compatibility</th>
  211. <th>Contained Elements</th>
  212. </tr>
  213. <tr>
  214. <th>io-schemata-result</th>
  215. <th>To return the schemata of input and output.</th>
  216. <th>completed</th>
  217. <th>yes</th>
  218. <th>&lt;desc&gt; &lt;in&gt; &lt;out&gt;</th>
  219. </tr>
  220. <tr>
  221. <th>output</th>
  222. <th>To submit the output.</th>
  223. <th>executing, completed</th>
  224. <th>yes</th>
  225. <th>&lt;out&gt;</th>
  226. </tr>
  227. <tr>
  228. <th>error</th>
  229. <th>To submit additional error information.</th>
  230. <th>executing</th>
  231. <th>no</th>
  232. <th>&lt;error&gt;</th>
  233. </tr>
  234. <tr>
  235. <th>status</th>
  236. <th>To indicate the current status of the procedure.</th>
  237. <th>executing</th>
  238. <th>no</th>
  239. <th>&lt;status&gt;</th>
  240. </tr>
  241. </table>
  242. </section2>
  243. <section2 topic='Container Elements' anchor='container'>
  244. <p>&lt;desc&gt; -- a textual description of the IO Data data container (xs:string).</p>
  245. <p>&lt;in&gt; -- contains the input. Valid for Transaction Type 'input' and 'io-schemata-result' only. May contain any XML data (XML Schema, XML Document ...).</p>
  246. <p>&lt;out&gt; -- contains the output. Valid for Transaction Type 'output' and 'io-schemata-result' only. May contain any XML data (XML Schema, XML Document ...).</p>
  247. <p>&lt;error&gt; -- describes the error raised by the procedure invocation. This element is optional and valid for Transaction Type 'error' and 'io-schemata-result' only. May contain any XML data (XML Schema, XML Document ...).</p>
  248. <p>&lt;status&gt; -- describes the status of the procedure. This element is optional and valid for Transaction Type 'status' only.</p>
  249. </section2>
  250. <section2 topic='Status Elements' anchor='status'>
  251. <p>&lt;elapsed&gt; -- an integer value of the time in milliseconds that elapsed since the procedure was invoked (xs:integer).</p>
  252. <p>&lt;remaining&gt; -- an integer value of the (estimated) time in milliseconds till the procedure will finish (xs:integer).</p>
  253. <p>&lt;percentage&gt; -- the percentage of the procedure that is finished (xs:integer).</p>
  254. <p>&lt;information&gt; -- describes the current status of the procedure.</p>
  255. </section2>
  256. </section1>
  257. <section1 topic='Implementation Notes' anchor='impl'>
  258. <p>Commands (= remote procedures) executed with Ad-Hoc Commands and IO Data SHOULD NOT keep the requester in an uncertain state. This means the responder SHOULD respond to the requester always as fast as possible. Thereby the requester acquires the sessionid. (As some remote procedures/calculations are cost-intensive and/or time-consuming the requester MUST "save" this sessionid for the case a network problem occurs.)</p>
  259. <p>The Ad-Hoc Command logic applied for the IO Data data container should be associated with the following rules and keywords:</p>
  260. <table caption='Subsequently allowed Ad-Hoc Commands are depending on the state of the service'>
  261. <tr>
  262. <th>Ad-Hoc Command</th>
  263. <th>Keyword</th>
  264. <th>Associated Transaction Type</th>
  265. <th>Subsequently allowed commands</th>
  266. <th>Status description</th>
  267. </tr>
  268. <tr>
  269. <th>execute</th>
  270. <th>Get Schemata</th>
  271. <th>io-schemata-get</th>
  272. <th>-</th>
  273. <th>XML Schemata are returned immediately</th>
  274. </tr>
  275. <tr>
  276. <th>execute</th>
  277. <th>Start procedure</th>
  278. <th>input</th>
  279. <th>-</th>
  280. <th>output returns immediately (synchronous)</th>
  281. </tr>
  282. <tr>
  283. <th></th>
  284. <th>Start procedure</th>
  285. <th>input</th>
  286. <th>next, cancel</th>
  287. <th>asynchronous procedure was invoked</th>
  288. </tr>
  289. <tr>
  290. <th>next</th>
  291. <th>Check status</th>
  292. <th>getStatus</th>
  293. <th>next, cancel</th>
  294. <th>asynchronous procedure not finished</th>
  295. </tr>
  296. <tr>
  297. <th></th>
  298. <th>Check status</th>
  299. <th>getStatus</th>
  300. <th>next, complete, cancel</th>
  301. <th>asynchronous procedure finished</th>
  302. </tr>
  303. <tr>
  304. <th></th>
  305. <th>Get result</th>
  306. <th>getOutput</th>
  307. <th>next, complete, cancel</th>
  308. <th>result was delivered</th>
  309. </tr>
  310. <tr>
  311. <th>cancel</th>
  312. <th>Cancel/delete procedure</th>
  313. <th>-</th>
  314. <th>-</th>
  315. <th>procedure terminated</th>
  316. </tr>
  317. <tr>
  318. <th>complete</th>
  319. <th>Get result + delete procedure</th>
  320. <th>-</th>
  321. <th>-</th>
  322. <th>result was delivered, procedure terminated</th>
  323. </tr>
  324. </table>
  325. <section2 topic='Synchronous implementation - for immediately completing services' anchor='sync_imp'>
  326. <ol>
  327. <li>If a service can return the output immediately, it MAY respond with status='completed' and return the output (IO Data type='output'). This behavior is NOT RECOMMENDED for procedures that need more than 5 seconds to complete or that are cost-intensive.</li>
  328. </ol>
  329. </section2>
  330. <section2 topic='Asynchronous implementation - for services that cannot return the output immediately' anchor='async_imp'>
  331. <ol>
  332. <li>If a service cannot return the result immediately (this refers to procedures that need more than 5 seconds to complete) or the invoked procedure is cost-intensive, it SHOULD response with status='executing' and a &lt;actions&gt; element containing the &lt;next&gt; element.</li>
  333. <li>If the service returned status='executing' the requester MAY stay up-to-date by proceeding with action='next' combined with the IO Data transaction type='getStatus'. The responder MUST respond with status='executing' and a &lt;actions&gt; element containing the &lt;next&gt; element only as long as the procedure is not finished.</li>
  334. <li>If the procedure finished the responder MUST respond to this request (action='next') combined with the IO Data transaction type='getStatus' with status='executing' and a &lt;actions&gt; element containing the &lt;next&gt; and the &lt;complete&gt; elements to indicate that the output is ready for collection. The requester MAY then request the result by proceeding with action='complete' or action='next' combined with the IO Data transaction type='getOutput'.</li>
  335. <li>Asynchronous notification: If the procedure finished the service MUST actively notify the requester by sending a message containing an Ad-Hoc Command element with status='executing' and a &lt;actions&gt; element containing the &lt;next&gt; and the &lt;complete&gt; elements to indicate that the result is ready for collection.</li>
  336. <li>If the requester requests the output with action='complete' the responder MUST return the result (IO Data transaction type='output') with status='completed'. This means the Ad-Hoc Command session terminated. The responder MUST subsequently delete associated procedure and result.</li>
  337. <li>If the requester requests the output with action='next' combined with the IO Data transaction type='getOutput' the responder MUST return the result (IO Data transaction type='output') with status='executing' and a &lt;actions&gt; element containing the &lt;next&gt; and the &lt;complete&gt; elements to indicate that the the Ad-Hoc Command session continues to exist and the output is still available. The requester MUST subsequently delete the associated procedure and result with action='cancel'.</li>
  338. </ol>
  339. </section2>
  340. <section2 topic='Error handling' anchor='error_imp'>
  341. <p>Beside the errors that are associated with IQ or Ad-Hoc Command abstraction layer an internal procedure error may occur.</p>
  342. <ol>
  343. <li>If the procedure invocation fails (an error occurs) the responder MUST respond with status='completed'. To indicate that the procedure failed the &lt;note&gt; element MUST have type='error' as described in XEP 50 Ad-Hoc Commands. The service may provide additional error information within the IO Data data container (IO Data transaction type='error').</li>
  344. <li>Asynchronous implementation only: If the service returned status='executing' (asynchronous implementation) and the procedure fails (an error occurs) the service MUST actively notify the requester by sending a message containing an Ad-Hoc Command element with status='executing' and a &lt;actions&gt; element containing the &lt;next&gt; element to the invoker. To indicate that the procedure failed the &lt;note&gt; element MUST have type='error' as described in XEP 50 Ad-Hoc Commands. The service may provide additional error information within the IO Data data container (IO Data transaction type='error'). The requester SHOULD subsequently delete the associated procedure with action='cancel'.</li>
  345. <li>Asynchronous implementation only: If the procedure failed (an error occurs) the responder MUST respond to a status request (action='next') with status='executing' and a &lt;actions&gt; element containing the &lt;next&gt; element to the requester. To indicate that the procedure failed the &lt;note&gt; element MUST have type='error' as described in XEP 50 Ad-Hoc Commands. The service may provide additional error information within the IO Data data container (IO Data transaction type='error'). The requester SHOULD subsequently delete the associated procedure with action='cancel'.</li>
  346. </ol>
  347. </section2>
  348. <section2 topic='Optional status information' anchor='status_imp'>
  349. <ol>
  350. <li>As long as the procedure did not finish (!) the service MAY provide additional status information within the IO Data data container (IO Data transaction type='status').</li> </ol>
  351. </section2>
  352. <p>Formalising machine to machine commands using the namespace defined herein, making such commands detectable and usable on-the-fly without the prerequisite for the requester to know the exact interface on the service site and the support for asynchronous as well as synchronous execution contributes to the usability of XMPP for complex grid-computing projects.</p>
  353. <p>In example an IDE could support the development of such projects by generating code interfaces (client stubs) to machine to machine capable XMPP services by discovering and requesting all required information on-the-fly.</p>
  354. </section1>
  355. <section1 topic='Use Cases' anchor='usecases'>
  356. <section2 topic='Discovering support' anchor='ret_coli'>
  357. <p>The requester can query for disco information on the command (Ad-Hoc Command) node to find out if it supports IO Data based commands.</p>
  358. <example caption='Disco request for command information'><![CDATA[
  359. <iq type='get'
  360. from='user@university.example.org'
  361. to='service.university.example.org'
  362. id='iq_125'>
  363. <query xmlns='http://jabber.org/protocol/disco#info'
  364. node='get_threedimensionalcoordinates'/>
  365. </iq>]]></example>
  366. <example caption='Disco result for command information'><![CDATA[
  367. <iq type='result'
  368. from='service.university.example.org'
  369. to='user@university.example.org'
  370. id='iq_125'>
  371. <query xmlns='http://jabber.org/protocol/disco#info'
  372. node='get_threedimensionalcoordinates'>
  373. <feature var='http://jabber.org/protocol/commands'/>
  374. <feature var='urn:xmpp:tmp:io-data'/>
  375. </query>
  376. </iq>]]></example>
  377. <p>To indicate support for IO Data it MUST include &lt;feature var='urn:xmpp:tmp:io-data'/&gt;. Of course the node can still provide &lt;feature var='jabber:x:data'/&gt; if this is supported, too.</p>
  378. </section2>
  379. <section2 topic='Retrieving the IO Schemata' anchor='ret-schemata'>
  380. <p>The 'in' and 'out' elements may each have any valid XML encoded elements as children. From a XML document style type of view &lt;in/&gt; and &lt;out/&gt; may be seen as root elements. Therefore it is required to "discover" the XML Schemata of the "dynamic children" of &lt;in/&gt; and &lt;out/&gt; (IO Schemata). This way a requester can marshal an API for the input and output of a certain service.</p>
  381. <p>Beside the 'in' and 'out' elements an 'error' element is optionally allowed and would be discovered in exactly the same. It is not included in the example to keep it simple.</p>
  382. <p>The XML Schemata request is done by setting the type of the IO Data element to 'io-schemata-get'.</p>
  383. <example caption='IO Schemata request'><![CDATA[
  384. <iq type='set'
  385. from='user@university.example.org'
  386. to='service.university.example.org'
  387. id='iq_126'>
  388. <command xmlns='http://jabber.org/protocol/commands'
  389. node='get_threedimensionalcoordinates'>
  390. <iodata xmlns='urn:xmpp:tmp:io-data' type='io-schemata-get'/>
  391. </command>
  392. </iq>
  393. ]]></example>
  394. <example caption='IO Schemata result'><![CDATA[
  395. <iq type='result'
  396. from='service.university.example.org'
  397. to='user@university.example.org'
  398. id='iq_126'>
  399. <command xmlns='http://jabber.org/protocol/commands'
  400. node='get_threedimensionalcoordinates'
  401. status='completed'>
  402. <iodata xmlns='urn:xmpp:tmp:io-data' type='io-schemata-result'>
  403. <desc>
  404. This service returns 3D atomic coordinates for the
  405. input structure. The input and output is encoded using the
  406. Chemical Markup Language (CML).
  407. </desc>
  408. <in>
  409. <xs:complexType>
  410. <xs:any namespace='http://www.xml-cml.org/schema'
  411. minOccur='1' maxOccur='1'/>
  412. </xs:complexType>
  413. </in>
  414. <out>
  415. <xs:complexType>
  416. <xs:any namespace='http://www.xml-cml.org/schema'
  417. minOccur='1' maxOccur='1'/>
  418. </xs:complexType>
  419. </out>
  420. </iodata>
  421. </command>
  422. </iq>
  423. ]]></example>
  424. <p>This service example requires the content of &lt;in/&gt; and &lt;out/&gt; to be <cite>Chemical Markup Language</cite> <note>The Chemical Markup Language: &lt;<link url='http://www.xml-cml.org/'>http://www.xml-cml.org/</link>&gt;.</note> by requiring input with the namespace 'http://www.xml-cml.org/schema'. Additionally, it also defines the returned output to be <cite>Chemical Markup Language</cite>.</p>
  425. </section2>
  426. <section2 topic='Executing a service' anchor='exec_serv'>
  427. <p>To keep the example simple the children of the 'in' and 'out' elements just contain strings (the protein name and protein sequence). However in real use cases it is likely that the children of 'in' and 'out' contain very complex XML documents with many different valid elements, namespaces, or values.</p>
  428. <p>The requester transmits the input to the service (responder) by setting the type of the IO Data element to 'input'.</p>
  429. <example caption='Execute Command request'><![CDATA[
  430. <iq type='set'
  431. from='user@university.example.org'
  432. to='service.university.example.org'
  433. id='iq_127'>
  434. <command xmlns='http://jabber.org/protocol/commands'
  435. node='get_proteinsequence'
  436. action='execute'>
  437. <iodata xmlns='urn:xmpp:tmp:io-data' type='input'>
  438. <in>
  439. <proteinname xmlns='http://university.example.org/protocol/proteinservice/proteinname'>
  440. CAB08284
  441. </proteinname>
  442. </in>
  443. </iodata>
  444. </command>
  445. </iq>
  446. ]]></example>
  447. <p>The service transmits the output to the requester by setting the type of the IO Data element to 'output'.</p>
  448. <example caption='Execute command result'><![CDATA[
  449. <iq type='result'
  450. from='service.university.example.org'
  451. to='user@university.example.org'
  452. id='iq_127'>
  453. <command xmlns='http://jabber.org/protocol/commands'
  454. sessionid='RPC-SESSION-0000001'
  455. node='get_proteinsequence'
  456. status='completed'>
  457. <iodata xmlns='urn:xmpp:tmp:io-data' type='output'>
  458. <out>
  459. <proteinsequence xmlns='http://university.example.org/protocol/proteinservice/proteinsequence'>
  460. mrkhpqsatk hlfvsggvas slgkgltass lgqlltargl hvtmqkldpy lnvdpgtmnp
  461. fqhgevfvte dgaetdldvg hyerfldrdl sgsanvttgq vystviaker rgeylgdtvq
  462. viphitdeik qrimamaqpd ggdnrpdvvi teiggtvgdi esqpfleaar qvrhdlgren
  463. vfflhvslvp hlapsgelkt kptqhsvaal rsigitpdal ilrcdrdvpe slknkialmc
  464. dvdidgvist pdapsiydip kvlhreelda fvvrrlnlpf rdvdwtewdd llrrvhephg
  465. tvrialvgky vdfsdaylsv sealhaggfk hyakvevvwv asddcetatg aaavladvhg
  466. vlipggfgir giegkigair yararglpvl glclglqciv ieatrsvglv qansaefepa
  467. tpdpvistma dqkeivagea dfggtmrlga ypavlqpasi vaqaygttqv serhrhryev
  468. nnayrdwiae sglrisgtsp dgylvefvey panmhpfvvg tqahpelksr ptrphplfva
  469. fvgaaidyks aellpveipa vpeisehlpn ssnqhrdgve rsfpapaarg
  470. </proteinsequence>
  471. </out>
  472. </iodata>
  473. </command>
  474. </iq>
  475. ]]></example>
  476. </section2>
  477. <section2 topic='Executing a time-consuming service' anchor='exec_serv_time'>
  478. <p>In this example the Ad-Hoc Command is a time-consuming and cost-intensive computation service. To keep the example simple the computation is a WAV to MP3 encoder - the input and output elements of this example make use of &xep0231;.</p>
  479. <example caption='Execute Command request'><![CDATA[
  480. <iq type='set'
  481. from='user@server.org'
  482. to='encoder.server.org'
  483. id='iq_128'>
  484. <command xmlns='http://jabber.org/protocol/commands'
  485. node='wav2mp3'
  486. action='execute'>
  487. <iodata xmlns='urn:xmpp:tmp:io-data' type='input'>
  488. <in>
  489. <data xmlns='urn:xmpp:tmp:data-element'
  490. alt='my-song.wav'
  491. type='audio/x-wav'>
  492. [ ... base64-encoded-audio ... ]
  493. </data>
  494. </in>
  495. </iodata>
  496. </command>
  497. </iq>
  498. ]]></example>
  499. <p>The service notifies the requester that the job is accepted: status='executing' and a &lt;actions&gt; element contains the &lt;next&gt; element.</p>
  500. <example caption='Execute command result'><![CDATA[
  501. <iq type='result'
  502. from='encoder.user.org'
  503. to='user@user.org'
  504. id='iq_128'>
  505. <command xmlns='http://jabber.org/protocol/commands'
  506. sessionid='RPC-SESSION-0000002'
  507. node='wav2mp3'
  508. status='executing'>
  509. <note type='info'>WAV to MP3 encoding has been started. You may stay up to
  510. date using the next-action.
  511. </note>
  512. <actions>
  513. <next/>
  514. </actions>
  515. </command>
  516. </iq>
  517. ]]></example>
  518. <p>The requester MAY stay up-to-date by proceeding with action='next' combined with the IO Data transaction type='getStatus'.</p>
  519. <example caption='Execute Command request'><![CDATA[
  520. <iq type='set'
  521. from='user@server.org'
  522. to='encoder.server.org'
  523. id='iq_129a'>
  524. <command xmlns='http://jabber.org/protocol/commands'
  525. sessionid='RPC-SESSION-0000002'
  526. node='wav2mp3'
  527. action='next'>
  528. <iodata xmlns='urn:xmpp:tmp:io-data' type='getStatus'>
  529. </command>
  530. </iq>
  531. ]]></example>
  532. <p>The service returns the status of the procedure. The "still calculating"-status is indicated with the &lt;actions&gt; element that contains the &lt;next&gt; element only. The "calculation finished"-status is indicated with the &lt;actions&gt; element that contains the &lt;next&gt; and &lt;complete&gt; elements.</p>
  533. <p>Optionally the result MAY contain additional status information within the IO Data element with IO Data transaction type='status' although is not shown here to keep the example simple.</p>
  534. <example caption='Execute command result'><![CDATA[
  535. <iq type='result'
  536. from='encoder.user.org'
  537. to='user@user.org'
  538. id='iq_129a'>
  539. <command xmlns='http://jabber.org/protocol/commands'
  540. sessionid='RPC-SESSION-0000002'
  541. node='wav2mp3'
  542. status='executing'>
  543. <actions>
  544. <next/>
  545. </actions>
  546. </command>
  547. </iq>
  548. ]]></example>
  549. <p>If the procedure is complete the service notifies the invoker with a message stanza containing an Ad-Hoc Command namespace with status='executing' and a &lt;actions&gt; element that contains the &lt;next&gt; and &lt;complete&gt; elements. The &lt;complete&gt; element indicates the calculation finished.</p>
  550. <example caption='Notification message'><![CDATA[
  551. <message from='encoder.user.org'
  552. to='user@user.org'>
  553. <command xmlns='http://jabber.org/protocol/commands'
  554. sessionid='RPC-SESSION-0000002'
  555. node='wav2mp3'
  556. status='executing'>
  557. <note type='info'>WAV to MP3 encoding finished. You may request the
  558. output now.</note>
  559. <actions>
  560. <complete/>
  561. <next/>
  562. </actions>
  563. </command>
  564. </iq>
  565. ]]></example>
  566. <p>After that the requester can request the output with the Ad-Hoc Command action='complete'.</p>
  567. <example caption='Execute Command request'><![CDATA[
  568. <iq type='set'
  569. from='user@server.org'
  570. to='encoder.server.org'
  571. id='iq_130a'>
  572. <command xmlns='http://jabber.org/protocol/commands'
  573. sessionid='RPC-SESSION-0000002'
  574. node='wav2mp3'
  575. action='complete'/>
  576. </iq>
  577. ]]></example>
  578. <p>The service returns the MP3 within the IO Data element. The status of the Ad-Hoc Command completed (status='completed').</p>
  579. <example caption='Execute command result'><![CDATA[
  580. <iq type='result'
  581. from='encoder.user.org'
  582. to='user@user.org'
  583. id='iq_130a'>
  584. <command xmlns='http://jabber.org/protocol/commands'
  585. sessionid='RPC-SESSION-0000002'
  586. node='wav2mp3'
  587. status='completed'>
  588. <iodata xmlns='urn:xmpp:tmp:io-data' type='output'>
  589. <out>
  590. <data xmlns='urn:xmpp:tmp:data-element'
  591. alt='my-song.mp3'
  592. type='audio/mpeg'>
  593. [ ... base64-encoded-audio ... ]
  594. </data>
  595. </out>
  596. </iodata>
  597. </command>
  598. </iq>
  599. ]]></example>
  600. <p>Alternatively the requester can request the output with the Ad-Hoc Command action='next' combined with the IO Data transaction type='getOutput'. This will keep the Ad-Hoc Command session alive and it must be deleted subsequently. This design allows to recover from network breakage during the result transmission state of the client-server communication, but allowing to request receiving the computation results or second time, because the session was left open after the first request.</p>
  601. <example caption='Execute Command request'><![CDATA[
  602. <iq type='set'
  603. from='user@server.org'
  604. to='encoder.server.org'
  605. id='iq_130b'>
  606. <command xmlns='http://jabber.org/protocol/commands'
  607. sessionid='RPC-SESSION-0000002'
  608. node='wav2mp3'
  609. action='next'>
  610. <iodata xmlns='urn:xmpp:tmp:io-data' type='getOutput'>
  611. </command>
  612. </iq>
  613. ]]></example>
  614. <p>The service returns the MP3 within the IO Data element. The status of the Ad-Hoc Command remains active (status='executing').</p>
  615. <example caption='Execute command result'><![CDATA[
  616. <iq type='result'
  617. from='encoder.user.org'
  618. to='user@user.org'
  619. id='iq_130b'>
  620. <command xmlns='http://jabber.org/protocol/commands'
  621. sessionid='RPC-SESSION-0000002'
  622. node='wav2mp3'
  623. status='executing'>
  624. <actions>
  625. <complete/>
  626. <next/>
  627. </actions>
  628. <iodata xmlns='urn:xmpp:tmp:io-data' type='output'>
  629. <out>
  630. <data xmlns='urn:xmpp:tmp:data-element'
  631. alt='my-song.mp3'
  632. type='audio/mpeg'>
  633. [ ... base64-encoded-audio ... ]
  634. </data>
  635. </out>
  636. </iodata>
  637. </command>
  638. </iq>
  639. ]]></example>
  640. <p>The requester MUST subsequently delete the remote procedure with the Ad-Hoc Command action='cancel'.</p>
  641. <example caption='Execute Command request'><![CDATA[
  642. <iq type='set'
  643. from='user@server.org'
  644. to='encoder.server.org'
  645. id='iq_131'>
  646. <command xmlns='http://jabber.org/protocol/commands'
  647. sessionid='RPC-SESSION-0000002'
  648. node='wav2mp3'
  649. action='cancel'/>
  650. </iq>
  651. ]]></example>
  652. <p>The remote procedure is deleted.</p>
  653. <example caption='Execute command result'><![CDATA[
  654. <iq type='result'
  655. from='encoder.user.org'
  656. to='user@user.org'
  657. id='iq_130'>
  658. <command xmlns='http://jabber.org/protocol/commands'
  659. sessionid='RPC-SESSION-0000002'
  660. node='wav2mp3'
  661. status='canceled'/>
  662. </iq>
  663. ]]></example>
  664. </section2>
  665. <section2 topic='Asynchronous error notification' anchor='async_error_serv_time'>
  666. <p>In case of an error the service the service notifies the invoker with a message stanza containing an Ad-Hoc Command namespace with status='executing' and a &lt;actions&gt; element that contains the &lt;next&gt; element. In addition to that it MUST contain a &lt;note&gt; element with type='error' to indicate the error.</p>
  667. <p>The error notification MAY contain additional error information within the IO Data element with IO Data transaction type='error'.</p>
  668. <example caption='Error notification message'><![CDATA[
  669. <message from='encoder.user.org'
  670. to='user@user.org'>
  671. <command xmlns='http://jabber.org/protocol/commands'
  672. sessionid='RPC-SESSION-0000002'
  673. node='wav2mp3'
  674. status='executing'>
  675. <note type='error'>#593 - The encoder could not parse the file.</note>
  676. <actions>
  677. <next/>
  678. </actions>
  679. <iodata xmlns='urn:xmpp:tmp:io-data' type='error'>
  680. <error>
  681. <errorcode/>593</errorcode>
  682. <description>The encoder could not parse the file.</description>
  683. </error>
  684. </iodata>
  685. </command>
  686. </iq>
  687. ]]></example>
  688. <p>In case of an error the service would respond to a status request (Ad-Hoc Command action='next' combined with the IO Data transaction type='getStatus') in a very similar way except that a &lt;iq&gt; and not a &lt;message&gt; would be used.</p>
  689. </section2>
  690. <section2 topic='Canceling a time-consuming service' anchor='cancel_serv_time'>
  691. <p>An asynchronous remote procedure may be canceled (deleted) by the invoker at any time.</p>
  692. <example caption='Cancel Command request'><![CDATA[
  693. <iq type='set'
  694. from='user@server.org'
  695. to='encoder.server.org'
  696. id='iq_129b'>
  697. <command xmlns='http://jabber.org/protocol/commands'
  698. node='wav2mp3'
  699. action='cancel'/>
  700. </iq>
  701. ]]></example>
  702. <p>The remote procedure is deleted.</p>
  703. <example caption='Cancel command result'><![CDATA[
  704. <iq type='result'
  705. from='encoder.user.org'
  706. to='user@user.org'
  707. id='iq_129b'>
  708. <command xmlns='http://jabber.org/protocol/commands'
  709. sessionid='RPC-SESSION-0000002'
  710. node='wav2mp3'
  711. status='canceled'/>
  712. </iq>
  713. ]]></example>
  714. </section2>
  715. </section1>
  716. <section1 topic='Error Codes' anchor='error'>
  717. <p>Error codes on the Ad-Hoc Command abstraction layer are inherited from Ad-Hoc Commands.</p>
  718. <p>Application specific errors associated with a remote procedure call realized with IO Data in combination with Ad-Hoc Commands were described in section 3 - Implementation notes.</p>
  719. </section1>
  720. <section1 topic='Internationalization Considerations' anchor='i18n'>
  721. <p>Internationalization of messages sent by the server is covered by setting the @xml:lang attribute of the &lt;iq&gt; element. Services should reply in the same language in which the client asked the question. That is, if the client specifies a locale using the @xml:lang attribute on the &lt;iq> element, then the server should reply in the same locale, and localize messages given in &lt;desc&gt;, &lt;node&gt;@info and &lt;query&gt;&lt;item&gt;@name.</p>
  722. </section1>
  723. <section1 topic='Security Considerations' anchor='security'>
  724. <p>To follow.</p>
  725. </section1>
  726. <section1 topic='IANA Considerations' anchor='iana'>
  727. <p>This document requires no interaction with &IANA;.</p>
  728. </section1>
  729. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  730. <section2 topic='Protocol Namespaces' anchor='ns'>
  731. <p>Until this specification advances to a status of Draft, its associated namespace shall be "urn:xmpp:tmp:io-data"; upon advancement of this specification, the &REGISTRAR; shall issue a permanent namespace in accordance with the process defined in Section 4 of &xep0053;.</p>
  732. </section2>
  733. </section1>
  734. <section1 topic='XML Schema' anchor='schema'>
  735. <code><![CDATA[
  736. <?xml version='1.0' encoding='UTF-8'?>
  737. <xs:schema
  738. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  739. targetNamespace='urn:xmpp:tmp:io-data'
  740. xmlns='urn:xmpp:tmp:io-data'
  741. elementFormDefault='qualified'>
  742. <xs:element name='iodata'>
  743. <xs:complexType>
  744. <xs:element name='desc' minOccurs='0' maxOccurs='1'
  745. type='xs:string'/>
  746. <xs:element name='in' minOccurs='0' maxOccurs='1'/>
  747. <xs:element name='out' minOccurs='0' maxOccurs='1'/>
  748. <xs:element name='error' minOccurs='0' maxOccurs='1'/>
  749. <xs:element name='status' minOccurs='0' maxOccurs='1'/>
  750. <xs:attribute name='type' use='required'>
  751. <xs:simpleType>
  752. <xs:restriction base='xs:NCName'>
  753. <xs:enumeration value='io-schemata-get'/>
  754. <xs:enumeration value='io-schemata-result'/>
  755. <xs:enumeration value='input'/>
  756. <xs:enumeration value='output'/>
  757. <xs:enumeration value='getStatus'/>
  758. <xs:enumeration value='getOutput'/>
  759. <xs:enumeration value='error'/>
  760. <xs:enumeration value='status'/>
  761. </xs:restriction>
  762. </xs:simpleType>
  763. </xs:attribute>
  764. <xs:anyAttribute/>
  765. </xs:complexType>
  766. </xs:element>
  767. <xs:element name='in'>
  768. <xs:choice>
  769. <!-- for x@type='io-schemata-result' : -->
  770. <xs:any namespace='http://www.w3.org/2001/XMLSchema'
  771. minOccurrence='1' maxOccurence='1'/>
  772. <!-- for x@type='input' : -->
  773. <xs:any namespace='##other' processContents='strict'/>
  774. </xs:choice>
  775. </xs:element>
  776. <xs:element name='out'>
  777. <xs:choice>
  778. <!-- for x@type='io-schemata-result' : -->
  779. <xs:any namespace='http://www.w3.org/2001/XMLSchema'
  780. minOccurrence='1' maxOccurence='1'/>
  781. <!-- for x@type='output' : -->
  782. <xs:any namespace='##other' processContents='strict'/>
  783. </xs:choice>
  784. </xs:element>
  785. <xs:element name='error'>
  786. <xs:choice>
  787. <!-- for x@type='io-schemata-result' : -->
  788. <xs:any namespace='http://www.w3.org/2001/XMLSchema'
  789. minOccurrence='1' maxOccurence='1'/>
  790. <!-- for x@type='error' : -->
  791. <xs:any namespace='##other' processContents='strict'/>
  792. </xs:choice>
  793. </xs:element>
  794. <xs:element name='status'>
  795. <!-- for x@type='status' -->
  796. <xs:element name='elapsed' minOccurs='0' maxOccurs='1'
  797. type='xs:integer'/>
  798. <xs:element name='remaining' minOccurs='0' maxOccurs='1'
  799. type='xs:integer'/>
  800. <xs:element name='percentage' minOccurs='0' maxOccurs='1'
  801. type='xs:integer'/>
  802. <xs:element name='information' minOccurs='0' maxOccurs='1'
  803. type='xs:string'/>
  804. </xs:element>
  805. </xs:schema>
  806. ]]></code>
  807. </section1>
  808. <section1 topic='Acknowledgements' anchor='ackn'>
  809. <p><link url='http://bioclipse.net/'>The Bioclipse Project</link></p>
  810. </section1>
  811. </xep>