xmlrpc_pstream.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
  2. <title>Xmlrpc_pstream User Manual</title>
  3. <body>
  4. <p><b>xmlrpc_pstream</b> makes a pseudo-XML-RPC remote procedure call
  5. (RPC) and displays the response. <b>xmlrpc_pstream</b> runs a
  6. pseudo-XML-RPC client.
  7. <p>The difference from true XML-RPC is that <b>xmlrpc_pstream</b>
  8. uses XML-RPC For C/C++'s &quot;pstream&quot; transport mechanism instead
  9. of HTTP. The pstream transport uses a simple TCP connection.
  10. <h2>Examples</h2>
  11. <pre>
  12. <tt>
  13. $ socketexec -connect \
  14. -remote_host=localhost -remote_port=8080 --filedes=3 -- \
  15. xmlrpc_pstream --serverfd=3
  16. &gt;sample.add i/3 i/5
  17. Result:
  18. Integer: 8
  19. </tt>
  20. </pre>
  21. <pre>
  22. <tt>
  23. $ socketexec -connect \
  24. -remote_host=localhost -remote_port=8080 --filedes=3 -- \
  25. xmlrpc_pstream sample.add i/3 i/5
  26. Result:
  27. Integer: 8
  28. </tt>
  29. </pre>
  30. <p>See the manual for the program <b>xmlrpc</b> for more examples;
  31. you specify the RPC arguments the same way.
  32. <h2>Overview</h2>
  33. <p>
  34. <b>xmlrpc_pstream</b>
  35. [<b>-serverfd=</b><i>integer</i>]
  36. [<i>methodName</i> [<i>parameter</i> ...]]
  37. <p><i>parameter</i>:
  38. <p>
  39. <b>i/</b><i>integer</i> |
  40. <b>s/</b><i>string</i> |
  41. <b>h/</b><i>hexstring</i> |
  42. <b>b/</b>{<b>true</b>|<b>false</b>|<b>t</b>|<b>f</b>} |
  43. <b>d/</b><i>realnum</i> |
  44. <b>n/</b> |
  45. <b><i>string</i></b>
  46. <P>Minimum unique abbreviation of option is acceptable. You may use double
  47. hyphens instead of single hyphen to denote options. You may use white
  48. space in place of the equals sign to separate an option name from its value.
  49. <h2>Description</h2>
  50. <p>This program is mainly useful for debugging and learning about
  51. XML-RPC servers. XML-RPC is such that the RPCs normally need to be made
  52. by a program rather than a person to be of use.
  53. <p>You supply a TCP connection to the server as an open file descriptor.
  54. <b>socketexec</b> is a good way to create that socket and pass it to
  55. <b>xmlrpc_pstream</b>.
  56. <p>You run <b>xmlrpc_pstream</b> in one of two modes: interactive and
  57. single RPC.
  58. <p>In interactive mode, which you select by giving no arguments to the
  59. program, <b>xmlrpc_pstream</b> prompts you for RPCs using the Readline
  60. library. You type in an RPC description and <b>xmlrpc_pstream</b>
  61. executes it, then asks you for another. This continues until you close
  62. the readline session (usually by typing Control-D). Then, the program
  63. exits, which causes the server file descriptor to close, which causes the
  64. client-server TCP connection to close, which means the client-server
  65. XML-RPC connection terminates.
  66. <p>In single RPC mode, you give the RPC information as arguments to
  67. the program. <b>xmlrpc_pstream</b> executes one RPC, then exits.
  68. But note that when you invoke <b>xmlrpc_pstream</b> with
  69. <b>socketexec</b> in single RPC mode, you can't exploit one of the
  70. main purposes of a pstream transport: it lets you establish an RPC
  71. session with the server. With the single RPC <b>socketexec</b>
  72. method, <b>socketexec</b> establishes a session with the server (by
  73. creating the TCP connection), then <b>xmlrpc_pstream</b> performs one
  74. RPC in that session, then the OS closes the session as
  75. <b>xmlrpc_pstream</b> exits (by virtue of closing the TCP socket).
  76. <h2>Arguments</h2>
  77. <p>There are no arguments in interactive mode. The fact that there are
  78. no arguments is what tells <b>xmlrpc_pstream</b> you want interactive mode.
  79. <p>For single RPC mode, the arguments are as follows.
  80. <dl>
  81. <dt><i>methodName</i>
  82. <dd>The name of the XML-RPC method you want to invoke.
  83. <dt><i>parameter</i> ...
  84. <dd>The list of parameters for the RPC. <b>xmlrpc_pstream</b> turns
  85. each of these arguments into an XML-RPC parameter, in the order given.
  86. You may specify no parameters if you like.
  87. <p>You specify the data type of the parameter with a prefix ending in
  88. a slash. Example: <b>i/5</b>. Here, the &quot;i&quot; signifies an
  89. integer data type. &quot;5&quot; is the value.
  90. <p><b>xmlrpc_pstream</b> is capable of only a subset of the
  91. possible XML-RPC types, as follows by prefix:
  92. <dl>
  93. <dt>i/
  94. <dd>integer (&lt;i4&gt;) (32 bit)
  95. <dt>s/
  96. <dd>string (&lt;string&gt;)
  97. <dt>h/
  98. <dd>byte string (&lt;base64&gt;). Specify the value in hexadecimal.
  99. <dt>b/
  100. <dd>boolean (&lt;boolean&gt;). Specify the value as &quot;true&quot; or
  101. &quot;t&quot; for true; &quot;false&quot; or &quot;f&quot; for false.
  102. <dt>d/
  103. <dd>double (&lt;double&gt;) (i.e. real number)
  104. <dt>n/
  105. <dd>nil (&lt;nil&gt;)
  106. <dt>I/
  107. <dd>64 bit integer (&lt;i8&gt;)
  108. </dl>
  109. <p>As a shortcut, if you don't specify a prefix (i.e. your argument does
  110. not contain a slash), <b>xmlrpc_pstream</b> assumes string data type.
  111. </dl>
  112. <h2>Options</h2>
  113. <dl>
  114. <dt><b>-serverfd=</b><i>integer</i>
  115. <dd>This identifies the client-server connection (and thus identifies the
  116. server). It is the file descriptor (an integer file handle) of the socket
  117. associated with an established TCP connection that you set up before
  118. invoking <b>xmlrpc_pstream</b>.
  119. <p>In interactive mode, don't use 0 or 1, because those are Standard Input
  120. and Standard Output and are used to communicate with you. 2 is a bad choice
  121. any time, because that is Standard Error and <b>xmlrpc_pstream</b> uses
  122. that to communicate with you.
  123. <p><b>socketexec</b> is a good way to create the required socket. Use
  124. the <b>socketexec</b>'s <b>-filedes</b> option to tell it what file descriptor
  125. to use for the socket, then use that same value on <b>xmlrpc_pstream</b>'s
  126. <b>-serverfd</b> option.
  127. <P>The default is 3.
  128. </dl>
  129. <h2>Interactive Commands</h2>
  130. <p>Example:
  131. <kbd>
  132. &gt; sample_add i/5 i/7
  133. </kbd>
  134. <p>In interactive mode, <b>xmlrpc_pstream</b> prompts you for RPC calls
  135. with the prompt &quot;&gt;&quot;.
  136. <p>At the prompt, type a series of words, delimited by one or more blanks.
  137. <p>The first word is the XML-RPC method name.
  138. <p>The remaining words are the parameters of the XML-RPC method, in the
  139. same form as the <b>xmlrpc_pstream</b> arguments for single RPC mode.
  140. </body>