Scala XML-RPC wrapper for apache java library https://ws.apache.org/xmlrpc/
It allows to work with input and output object with familar case classes.
libraryDependencies += "com.github.adenza" %% "xmlrpc-scala-client" % "0.1.1"or
resovers += Resolver.sonatypeReso("snashots") libraryDependencies += "com.github.adenza" %% "xmlrpc-scala-client" % "0.1.0-SNAPSHOT"First define input parameters and expected result:
case class InputParams(currency: String, amount: Int) case class Result(status: String) Now it possible to instantiate client and make a call:
import com.github.adenza.xmlrpc.client._ val config = XmlRpcScalaConfig( serverUrl = new java.net.URL("http://localhost:8080"), basicUserName = "user" , basicPassword = "password", enabledForExceptions = true, enabledForExtensions = false ) val xmlRpcClient = new XmlRpcScalaClient(config) val params = InputParams("USD", 1000) val result: Future[Result] = xmlRpcClient.call[Result]("AddValue", params) import com.github.adenza.xmlrpc.exceptions._ val handledResult = result.recoverWith { case ex: XmlRpcScalaClientException => throw new Exception("Xml Rpc server return code " + ex.getCode) case ex => throw new Exception("Unexpected exception", ex) }