For this recipe, perform the following steps:
- Get the required dependencies.
- 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"
- 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: ...