|
|
## [Home](https://git.opendfki.de/delight/delight/wikis/Home) | [Documentation](https://git.opendfki.de/delight/delight/wikis/Documentation) | [People / Contact](https://git.opendfki.de/delight/delight/wikis/people)
|
|
|
---
|
|
|
|
|
|
Legacy: [XML-RPC Delight](xmlrpc/Documentation)
|
|
|
|
|
|
|
|
|
XML-RPC Delight is meant for: All users that want to have their java components connected using a web-based protocol but don't want to waste time with defining the interfaces a second time in another language-independend description format and then generate stubs and skeletons and so on.
|
|
|
# Welcome to the delight JSON over HTTP
|
|
|
|
|
|
XML-RPC Delight is an addon to the XML-RPC specification (http://www.xmlrpc.com/spec) and builds on apache's implementation (http://ws.apache.org/xmlrpc/), version 1.1 (Download here, patched to handle UTF-8, long strings containing control characters and XML markup correctly; transfer full exception stacktrace).
|
|
|
This Delight backend implementation offers JSON-based RPC calls based on Java interfaces and abstract Java classes.
|
|
|
|
|
|
#### Design Objectives
|
|
|
Start your Java Service and access it without much effort ...
|
|
|
|
|
|
* have java components interact over internet wire with a minimum of programming and configuration effort
|
|
|
* preserve XML-RPC compliance
|
|
|
* make EVERY type XML-RPC transportable with minimal coding effort (ideally, not a single line of extra code!)
|
|
|
* do not interfere with design of remote interfaces. Within the remote calls, one should be able to use any type or interface he wants.
|
|
|
* neither the client nor the server has to be forced to load configuration files or register factories programatically in order to use non XML-RPC compliant types in remote calls.
|
|
|
Define a Java-Interface, for example
|
|
|
|
|
|
#### Overview
|
|
|
public interface ServiceApi {
|
|
|
int doSometing(String parameter);
|
|
|
}
|
|
|
|
|
|
Then you can register an implementation (let's call it `ServiceImpl`) of this API with the Delight backend.
|
|
|
The implementation is called a handler.
|
|
|
|
|
|
XML-RPC Delight creates remote clients to java APIs that are supposed to be used remotely. XML-RPC Delight does this at runtime, not at compile time!
|
|
|
In case the API uses types which are not XML-RPC compliant, java annotations and user-defined conversion methods allow for automatic transformation of types to and from a XML-RPC compliant representation. Optimally, one can use non-compliant java classes in XML-RPC calls without having to code a single line of code!!
|
|
|
DelightConfig cfg = DelightConfigFinder.getDefaultConfig()
|
|
|
DelightServer server = new DelightServer(cfg)
|
|
|
.port( 8080 )
|
|
|
.path( "/delight" )
|
|
|
.init( backend -> {
|
|
|
backend.addHandlerByClass("handler-x", ServiceImpl.class);
|
|
|
});
|
|
|
server.start();
|
|
|
server.waitForShutdown();
|
|
|
|
|
|
Now you can do RPC calls to this backend with any tool which is able to send HTTP requests. Here is the Java client:
|
|
|
|
|
|
While all the automatic conversion is done, communication with the server is still XML-RPC compliant so that remote methods can still be called by non-java languages.
|
|
|
DelightConfig cfg = DelightConfigFinder.getDefaultConfig();
|
|
|
Delight delight = new Delight(cfg);
|
|
|
|
|
|
ServiceApi service = delight
|
|
|
.connectingTo("http://localhost:8080/delight")
|
|
|
.usingApi("handler-x", ServiceApi.class);
|
|
|
service.doSometing("acme param");
|
|
|
|
|
|
**Delight** is used in several projects of the [Smart Data and Knowledge Services](https://sds.dfki.de/DFKI)'s Lab including [Mymory](http://www.dfki.de/mymory),
|
|
|
[Nepomuk](http://nepomuk.semanticdesktop.org), [Perspecting](http://www.dfki.uni-kl.de/perspecting), [Epiphany](http://projects.dfki.uni-kl.de/epiphany), [DynaQ](http://dynaq.opendfki.de/) and [Medical CPS](http://www.dfki.de/MedicalCPS).
|
|
|
### Detailed Descriptions
|
|
|
|
|
|
**Delight** is published under [LGPL](http://www.gnu.org/licenses/lgpl.html). |
|
|
\ No newline at end of file |
|
|
* [Create a Delight Service](ExampleService)
|
|
|
* [Delight with pure HTTP Requests](ExampleJavaClient)
|
|
|
* [Delight with pure HTTP Requests](ExampleHttpRequests) |