Jump to page: 1 2
Thread overview
XML RPC Client and Server - meet xmlrpc-d
Sep 01, 2013
Pavel Kirienko
Sep 02, 2013
angel
Sep 02, 2013
Pavel Kirienko
Sep 02, 2013
Flamaros
Sep 02, 2013
ilya-stromberg
Sep 02, 2013
Pavel Kirienko
Sep 02, 2013
ilya-stromberg
Sep 02, 2013
Pavel Kirienko
Sep 02, 2013
ilya-stromberg
Sep 02, 2013
Flamaros
Sep 02, 2013
Dmitry Olshansky
Sep 02, 2013
Dicebot
Sep 03, 2013
Pavel Kirienko
Sep 03, 2013
ilya-stromberg
September 01, 2013
Hi everyone,

I am working on some D-based project that needs to call and serve XML-RPC procedures with multiple output parameters. Quick lookaround revealed that:
1. There are no XML-RPC servers implemented in D, or wrapped in D;
2. There are some simple XML-RPC clients, but no one supports methods with multiple output parameters.

So I decided to write ultimate XML-RPC library that could follow XML-RPC standard as close as ... well, as I could manage it. :)

Grab your copy here: https://github.com/pavel-kirienko/xmlrpc-d

D's compile-time introspection is utterly amazing, it enables such features as automatic conversion of a value which type is not known at compile-time to something predefined. This makes possible to define XML-RPC methods in the simplest way possible (as regular functions), all the boring job of turning the function parameters into XML-RPC types and vice versa is carried out by compiler with the help of the Variant type:

----------
real multiply(real a, real b) { return a * b; }
xmlrpcServer.addMethod!multiply();
----------

Which also makes possble such weird things like that:

----------
// multiply() expects two arguments of type 'real' and returns 'real',
// but we call it with strings:
string ret = client.call!("multiply", string)("6", "9");
----------

Take a look into the 'example' directory on the Github page to see more examples.

It is worth to mention that this is my first project in D - I was concurrently studying "The D Programming Language" by Andrei Alexandrescu (great book Andrei!), thus the code may need some review.


Good luck with your projects,
Pavel.
September 02, 2013
Did you look at std.serialization (currently in the review queue)
? An RPC does need serialization.
September 02, 2013
On Monday, 2 September 2013 at 05:53:22 UTC, angel wrote:
> Did you look at std.serialization (currently in the review queue)
> ? An RPC does need serialization.

Yes I'm aware of std.serialization, but it does not seem to
support XML-RPC data representation.

So I decided to use std.xml, with plans to switch to std.xml2
when available.
September 02, 2013
On Sunday, 1 September 2013 at 19:50:47 UTC, Pavel Kirienko wrote:
> Hi everyone,
>
> I am working on some D-based project that needs to call and serve XML-RPC procedures with multiple output parameters. Quick lookaround revealed that:
> 1. There are no XML-RPC servers implemented in D, or wrapped in D;
> 2. There are some simple XML-RPC clients, but no one supports methods with multiple output parameters.
>
> So I decided to write ultimate XML-RPC library that could follow XML-RPC standard as close as ... well, as I could manage it. :)
>
> Grab your copy here: https://github.com/pavel-kirienko/xmlrpc-d
>
> D's compile-time introspection is utterly amazing, it enables such features as automatic conversion of a value which type is not known at compile-time to something predefined. This makes possible to define XML-RPC methods in the simplest way possible (as regular functions), all the boring job of turning the function parameters into XML-RPC types and vice versa is carried out by compiler with the help of the Variant type:
>
> ----------
> real multiply(real a, real b) { return a * b; }
> xmlrpcServer.addMethod!multiply();
> ----------
>
> Which also makes possble such weird things like that:
>
> ----------
> // multiply() expects two arguments of type 'real' and returns 'real',
> // but we call it with strings:
> string ret = client.call!("multiply", string)("6", "9");
> ----------
>
> Take a look into the 'example' directory on the Github page to see more examples.
>
> It is worth to mention that this is my first project in D - I was concurrently studying "The D Programming Language" by Andrei Alexandrescu (great book Andrei!), thus the code may need some review.
>
>
> Good luck with your projects,
> Pavel.

We'll need RPC for our projects, we are interested.

I hope you'll made pull requests for an integration to phobos.


Good luck.
September 02, 2013
On Monday, 2 September 2013 at 10:31:15 UTC, Flamaros wrote:
> We'll need RPC for our projects, we are interested.
>
> I hope you'll made pull requests for an integration to phobos.

+1
It's really useful project.
September 02, 2013
On Monday, 2 September 2013 at 14:07:52 UTC, ilya-stromberg wrote:
> On Monday, 2 September 2013 at 10:31:15 UTC, Flamaros wrote:
>> We'll need RPC for our projects, we are interested.
>>
>> I hope you'll made pull requests for an integration to phobos.
>
> +1
> It's really useful project.

Thanks!

To be honest, the HTTP server shipped with this library is not so hot, it is just a stub which purpose is to fill the lacking of the default HTTP server in phobos.

https://github.com/pavel-kirienko/xmlrpc-d/blob/master/src/http_server_bob.d

I think there is no place for this particular piece of code in phobos.

So, the question is: shall I make a pull request for xmlrpc-d with no HTTP server included? Is there anyone who have a solid HTTP server which is good enough for the standard library? We could cooperate.
September 02, 2013
On Monday, 2 September 2013 at 10:31:15 UTC, Flamaros wrote:
> I hope you'll made pull requests for an integration to phobos.

I should warn - it won't be easy and is likely to require lot of work from contributor. Recent trend in Phobos contribution is to require good integration with existing modules and approaches - you can have a look at `std.serialization` threads to see what Jacob is going to go through to get to voting. One may argue if it is too demanding but I personally like high quality and consistency levels defined by standard library.
September 02, 2013
On Monday, 2 September 2013 at 15:12:24 UTC, Pavel Kirienko wrote:
> So, the question is: shall I make a pull request for xmlrpc-d with no HTTP server included? Is there anyone who have a solid HTTP server which is good enough for the standard library? We could cooperate.

As I know, the Vibe.d is good:
https://github.com/rejectedsoftware/vibe.d

But I don't know if it will be useful for you.
September 02, 2013
On Monday, 2 September 2013 at 15:37:16 UTC, ilya-stromberg wrote:
> On Monday, 2 September 2013 at 15:12:24 UTC, Pavel Kirienko wrote:
>> So, the question is: shall I make a pull request for xmlrpc-d with no HTTP server included? Is there anyone who have a solid HTTP server which is good enough for the standard library? We could cooperate.
>
> As I know, the Vibe.d is good:
> https://github.com/rejectedsoftware/vibe.d
>
> But I don't know if it will be useful for you.

I know vibe.d, but it does not seem to be going into phobos, does it?


> I should warn - it won't be easy and is likely to require lot of work from contributor. Recent trend in Phobos contribution is to require good integration with existing modules and approaches - you can have a look at `std.serialization` threads to see what Jacob is going to go through to get to voting.

Yeah it is not so easy I know, and I'm not sure I can make time for that right now. However, if someone wants to volunteer I'd glad to help.
September 02, 2013
On Monday, 2 September 2013 at 15:54:12 UTC, Pavel Kirienko wrote:
> I know vibe.d, but it does not seem to be going into phobos, does it?

I don't know, you should contact Sönke Ludwig to find out it.
As I can see, there are a lot of code that could be useful for Phobos.
« First   ‹ Prev
1 2