Skip to content

NeovaHealth/t4xmlrpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neova Health XML-RPC

Build Status


This library provides a simple and easy to use xml-rpc implementation in scala. It supported scala 2.10 and 2.11.

####Changelog####

2.0.2 Release

This is a simplification and updating of the 2.0 release, removing custom data structures in favour of existing ones and removing the error accumulating feature in favour of a fail-fast approach using scalaz's / datatype. Also added the ability to provide a java.util.concurrent.Executor to the client, defaulting to a CachedThreadPool. Now uses the latest releases from scalaz, dispatch and scalalogging.

Motivation

Existing xml-rpc libraries from the java world (such as apache's offering) end up tossing around arrays of Objects, which in the typesafe world of scala, is not ideal and quite messy to use.

Therefore we decided to implement our own version of xml-rpc, casting to type as early as possible and making use of scala 2.10's Futures as well as the scalaz library.

Use case

import scala.concurrent.ExecutionContext.Implicits.global

val config = new XmlRpcConfig("http", "localhost", 8888, "/pathToHit")

val client = new XmlRpcClient()

val result = client.request(config, "someMethod", "someParameter")

result.fold(
    error  => println(s"Got back a fault: $error"),
    result => println(s"Got back a result: $result")
    )
)

SBT Settings

Just add t4xmlrpc as a dependency to your build file:

Stable:

"com.tactix4" %% "t4xmlrpc" % "2.0.2"

Details

We use Dispatch to handle the actual http calls, but this could easily be extended to support other transport libraries. Dispatch was chosen due to the relatively small number of dependencies (and the fact that it works great!)

Internally we model all the xmlrpc data types, and parameters provided to XmlRpcClient.request must be one of these types, so package.scala contains some convenient implicit conversions.

Depending on the data you are sending, you might want to provide your own conversions or wrap the datatypes appropriately.

License

All code is released under the GNU Affero General Public License Version 3

Contribute

Please report any bugs/issues or submit a pull request.

About

XML-RPC library written in Scala

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages