https://github.com/pavel-kirienko/xmlrpc-d
XML RPC Library for D Programming Language
https://github.com/pavel-kirienko/xmlrpc-d
Last synced: about 2 months ago
JSON representation
XML RPC Library for D Programming Language
- Host: GitHub
- URL: https://github.com/pavel-kirienko/xmlrpc-d
- Owner: pavel-kirienko
- License: mit
- Created: 2013-08-25T19:56:27.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-11-14T20:00:23.000Z (over 11 years ago)
- Last Synced: 2025-02-10T21:19:38.612Z (4 months ago)
- Language: D
- Size: 266 KB
- Stars: 3
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
XML-RPC for D Programming Language
========
## Basic usage
### Client
```d
import xmlrpc.client;auto client = new Client("http://localhost:8000/");
int answer = client.call!("multiply", int)(6, 9);
assert(answer != 42);auto swappedStrings = client.call!("swap", string, string)("first", "second");
assert(swappedStrings[0] == "second" && swappedStrings[1] == "first");auto swappedIntAndString = client.call!("swap", int, string)("hi", 17);
assert(swappedIntAndString[0] == 17 && swappedIntAndString[1] == "hi");
```
Refer to `example/client.d` to learn more.### Server
```d
import xmlrpc.server;
import http_server_bob;auto xmlrpcServer = new Server();
auto httpServer = new HttpServer(8000);
httpServer.requestHandler = (request)
{
HttpResponseData httpResponse;
auto encodedResponse = xmlrpcServer.handleRequest(cast(string)request.data);
httpResponse.data = cast(const(ubyte)[])encodedResponse;
return httpResponse;
};real multiply(real a, real b) { return a * b; }
xmlrpcServer.addMethod!multiply();Variant[] swap(Variant[] args) { return [args[1], args[0]]; }
xmlrpcServer.addRawMethod(&swap, "swap");httpServer.spin();
```
Refer to `example/server.d` to learn more.## Advanced examples
```shell
cd example && ./build.sh
# Start the server:
./build/server
# Switch to another terminal and execute the client:
./build/client
```## Installation
```shell
# Optionally: INSTALL_PREFIX=/your/install/prefix
# Default INSTALL_PREFIX is /usr/local/
./build.sh install
```## Requirements
Currently the client part of the library uses `libcurl`.