Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • delight delight
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Commits
Collapse sidebar
  • delight
  • delightdelight
  • Wiki
  • Xmlrpc
  • ExampleUsingXmlRpcCompliantTypes

ExampleUsingXmlRpcCompliantTypes · Changes

Page history
started documentation of json-over-http delight authored Mar 05, 2019 by Andreas Lauer's avatar Andreas Lauer
Hide whitespace changes
Inline Side-by-side
xmlrpc/ExampleUsingXmlRpcCompliantTypes.md 0 → 100644
View page @ 91ec85b6
## [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)
---
### Using XML-RPC compliant types in your API
If you use types in your remote calls which are XML-RPC compliant things are very easy:
#### Server side
- The server side defines an API to be used remotely over XML-RPC. Additionally an implementation
of the API is hosted on the server-side
```java
interface Api {
String getStatusMessage( int code );
int[] getInts();
}
class Impl implements Api {
public String getStatusMessage( int code ) {...}
public int[] getInts() { return new int[]{ 1,2,3 }; }
}
```
- register implementation as XML-RPC handler with the server
```java
WebServer xmlRpcServer = new WebServer( port );
xmlRpcServer.addHandler( "handlerId", XmlRpcHandlerFactory.createHandlerFor( new Impl() ) );
xmlRpcServer.start();
```
#### Client side
- create a remote client the use the API by simply calling a method like a local call.
```java
Api remote_api = XmlRpc.createClient( Api.class, "handlerId", host, port );
String msg = remote_api.getStatusMessage( 42 );
int[] ints = remote_api.getInts();
...
```
#### Special type treatment
- conversions for types Integer, Double and Boolean to their primitive counterparts and vice versa is done automatically
- instead of solely using java type Vector for XML-RPC type ARRAY, also every type implementing Collection can be used (i.e., as return values).
- instead of solely using java type Hashtable for XML-RPC type STRUCT, also java type Map can be used.
- arrays of convertible types including their primitive counterparts (such as Integer, int, ...) can be used out-of-the-box
\ No newline at end of file
Clone repository
  • DocuFeature
  • ExampleServer
  • ExampleWebApp
  • Home
  • ServerSentEventsFeature
  • StatsFeature
  • people
  • xmlrpc
    • Documentation
    • ExampleUsingConverterRegistry
    • ExampleUsingOwnConceteTypes
    • ExampleUsingOwnInterfaceTypes
    • ExampleUsingThirdPartyTypes
    • ExampleUsingXmlRpcBeans
    • ExampleUsingXmlRpcCompliantTypes

Legal Notice, Imprint, Privacy Policy