Xenium
A simple client toolkit for making XML-RCP calls and reading responses. The current XML-RPC has a bit of a learning curve. Chances are if you’re using XML-RPC, you just want to get stuff done now. Xenium allows you to skip all the technicals of XML-RPC and HTTP and get to getting stuff done.
XML-R..P… what?
XML-RPC is just regular XML that fits a certain standardized spec. It’s for issuing remote procedure calls using HTTP. RPC allows the client to send a request to a server which will execute a command based on the request and any other parameters in the call. Along the same line is JSON-RPC. The main idea is that the server and client can be written in any language.
Xeeny… what?
A xenium, from Greek, is a gift for strangers and travellers like a banquet or smaller meal.
Installation
If available in Hex, the package can be installed
by adding xenium to your list of dependencies in mix.exs:
def deps do
[
{ :xenium, "~> 0.1.0" }
]
endCurrently, this isn’t on hex. (I’m too hip and cool for that.) You can clone this repo and then:
def deps do
[
{ :xenium, path: "path/to/top-level/dir/of/repo" }
# example if you cloned into ~
# { :xenium, path: "~/xenium" }
]
endUsage
There are two functions at the moment. call! just calls the server. Here’s
an example that interacts with ROS (see
ROS documentation):
iex> url = System.get_env("ROS_MASTER_URI")
http://localhost:11311
iex> Xenium.ask! url, "getSystemState", ["/"]
[1, 'current system state', [[['/rosout_agg', ['/rosout']]], [['/time', ['/rosout']], ['/rosout', ['/rosout']], ['/clock', ['/rosout']]], [['/rosout/set_logger_level', ['/rosout']], ['/rosout/get_loggers', ['/rosout']]]]]call makes the same call, but allows you to inspect failures. It returns a
tuple { :ok, response } if it’s successful and { :error, error } on error.
The errors are carried over from the HTTPoison and XML-RPC libraries, so playing
around in iex is the best environment for the call method.
Documentation
Documentation is done by ExDocs. When it’s live, it’ll be here.
In the meantime, ExDocs is a dev dep, so just go to the top-level dir and run
mix docs and then open docs/index.html.