How to do it...

For this recipe, perform the following steps:

  1. Get the required dependencies. 
  2. Edit the build.sbt file and add the akka-http-xml dependency as follows:
        libraryDependencies += "com.typesafe.akka" %           "akka-http-xml_2.11" % "10.0.5"
  1. Now create a file named OrderModel.scala in the com.packt.chapter9 package. This file will contain the case classes you are going to use. If you did the previous recipe, the model classes will be the same. Also, it will include the trait to do the marshaling and unmarshaling automatically. The content should be as follows:
        package com.packt.chapter9        import akka.http.scaladsl.marshallers.xml.ScalaXmlSupport        import scala.xml._        case class Item(id: Int, quantity: Int, unitPrice: Double,         percentageDiscount: ...

Get Akka Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.