scalaxb is an XML data-binding tool for Scala that supports W3C XML Schema (xsd) and Web Services Description Language (wsdl) as the input file.


The latest is 1.5.0.
Many things still may not work. I'd really appreciate if you could run it against your favorite xsd file and let me know the result.


$ scalaxb [options] <schema_file>...
  -d <directory> | --outdir <directory>
        generated files will go into <directory>
  -p <package> | --default-package <package>
        specifies the target package
        specifies the target package for <namespaceURI>
  --class-prefix <prefix>
        prefixes generated class names
  --param-prefix <prefix>
        prefixes generated parameter names
        prepends family name to class names
  --wrap-contents <complexType>
        wraps inner contents into a seperate case class
  --contents-limit <size>
        defines long contents to be segmented (default: 20)
  --chunk-size <size>
        segments long sequences into chunks (default: 10)
        generates package directories
  --protocol-file <name.scala>
        protocol file name (xmlprotocol.scala)
  --protocol-package <package>
        package for protocols
        skips runtime files
        relaxes namespace constraints of xs:any
        generates blocking SOAP client
  --dispatch-version <version>
        version of Dispatch (default: 0.11.1)
  -v | --verbose
        be extra verbose
        display this message
        display version info
        input schema to be converted

scalaxb 1.5.1

bug fixes


scalaxb 1.5.0

breaking changes

  • Fixes name clashes in typeclass intance by prefixing full package name. #385 by @anatoliykmetyuk
  • The default value for using varargs is set to false.
  • sbt-scalaxb is now an auto plugin. See below.

bug fixes


  • Adds --mutable option to generate mutable case classes. See below.
  • Uses type attribute to convert xs:any. #389 by @anatoliykmetyuk
  • Adds --autopackages option to pick package names automatically. #391 by @anatoliykmetyuk
  • Adds --visitor option to generate a Visitor for traversing over the generated case classes. #392 by @anatoliykmetyuk

sbt-scalaxb changes

sbt-scalaxb for scalaxb 1.5.0 is changed to an auto plugin.
Instead of adding scalaxbSettings and defining sourceGenerators in Compile,
enable ScalaxbPlugin instead. All other setting/task keys will be prefixed with "scalaxb".
For example, packageName will now be called scalaxbPackageName.


import ScalaxbKeys._
lazy val root = (project in file(".")).
    name := "foo-project").
    sourceGenerators in Compile += (scalaxb in Compile).taskValue,
    packageName in (Compile, scalaxb) := "generated"
    // packageNames in (Compile, scalaxb) := Map(uri("http://something/") -> "something"),
    // logLevel in (Compile, scalaxb) := Level.Debug


lazy val root = (project in file(".")).
    name := "foo-project",
    scalaxbPackageName in (Compile, scalaxb) := "generated"
    // scalaxbAutoPackages in (Compile, scalaxb) := true

#405 by @eed3si9n

mutable case class

scalaxb 1.5.0 adds an option to generate mutable case classes.

case class Address(var name: String,
  var street: String,
  var city: String)

In sbt-scalaxb, this can be enabled as:

lazy val root = (project in file(".")).
    name := "foo-project",
    scalaxbPackageName in (Compile, scalaxb) := "generated",
    scalaxbGenerateMutable in (Compile, scalaxb) := true

#390 by @AndreVanDelft


Huge thanks to everyone who has helped to improve scalaxb by sending pull requests and reporting bugs!

According to git shortlog -sn --no-merges 1.4.1..release/1.5.0, the following people contributed to this release: Anatoliy Kmetyuk (@anatoliykmetyuk), Eugene Yokota (@eed3si9n), Andre Van Delft (@AndreVanDelft), Jan-Kees van Andel (@jankeesvanandel), Joshua Reese (@joshlreese), and Mateusz Kołodziejczyk (@coutoPL).

scalaxb 1.4.1

breaking changes

  • Adds Dispatch 0.11.3 support, and defaultDispatchVersion is bumped up to it. #352 by @DustinChaloupka


  • Fixes handling of implicit and explicit SOAP headers. #366 by @coutoPL

who is using scalaxb?

Here's a list of users who are using scalaxb, or have at some point.


Non-blocking SOAP feature was also contributed by @hoff2 from Banno.


Scoozie: Creating Big Data Workflows at Klout

Additionally, we would like to provide a shout-out to a great open-source project, scalaxb, an sbt plugin that takes .xsd files and creates matching Scala case classes. Scoozie populates these case classes, which are then automatically converted to XML by scalaxb. This plugin saved a lot of headache in the actual process of conversion to XML.


Dispatch forms the foundation of an in-house SOAP client at Novus together with scalaxb. Thanks to these tools our standard response to “Can you do SOAP?” is “Bring it on!” instead of “Ew, what’s this on my shoe?!”

VMWare vCloud

Using Salat with scalaxb generated classes:

scalaxb generates Scala case classes from XSDs and generates supporting helpers for going back and forth from case class to XML. Salat provides an interface to MongoDB based on case classes.

There are a couple hurdles, but both project owners have taken our suggestions seriously, and have smoothed out quite a few bumps.

scalaxb 1.4.0

SOAP/REST changes

  • Adds requestTimeout and connectionTimeout to DispatchHttpClients. #304 by @eed3si9n
  • Adds --no-dispatch-client option (generateDispatchClient := false). #322 by @liff
  • Adds --dispatch-as option (generateDispatchAs := true) for Dispatch's Http(request > as.scalaxb[A]) support. #332 by @arkadius

other enhancements

  • Adds --ignore-unknown option (ignoreUnknown := true) to ignore unknown XML elements, as well as order in which they are arrived. #310 by @jet-black
  • Adds --no-varargs option to use Seq instead of the varargs. #292/#309 by @lbruand and @Erwan56
  • Improves handling of duplicate enumeration values. #308 by @donderom
  • Refactors configuration into a sequence of case classes. #342 by @eed3si9n

bug fixes

compiler warnings

The code generated by scalaxb 1.4.0 should no longer generate compiler warnings.

  • Adds SIP-18 imports to the generated code. #294 by @carl297r
  • Removes "adapting argument list" and other compiler warnings from the generetad code. #321 by @liff
  • Removes compiler warnings from the scalaxb code. #335 by @justjoheinz
  • Removes postfix usages in the generated code.
  • Adds -Xfatal-warnings during the integration tests. #343 by @eed3si9n


A huge thanks to everyone who has helped to improve scalaxb by reporting bugs and sending pull requests!

According to git shortlog -sn --no-merges 1.3.0..release/1.4.0 ten people contributed to this release: Eugene Yokota (@eed3si9n), @jet-black, Olli Helenius (@liff), Lucas Bruand (@lbruand), Markus Klink (@justjoheinz), Carl Livermore (@carl297r), Arek Burdach (@arkadius), Joe Barnes (@joescii), @Erwan56, Roman Parykin (@donderom).

scalaxb 1.3.0

breaking changes

  • Dropping SOAP RPC/encoded support.
  • Makes SOAP faultactor a String. #268 by @rubbish
  • Generates >22 case classes by default. #280
  • Generates attributes field to handle all attributes. #286

SOAP changes

  • Fixes the handling of message parts involving headers. #285 by @plaflamme
  • Fixes nillable fault support. #284
  • Makes http instances lazy. #279 by @rubbish
  • Implements toString methods for faults. #278

case class >22 and attributes change

Starting scalaxb 1.3.0, the generated code will be >22 by default. In addition, all attributes will be handled via attributes field.

To bring back the older behavior:

contentsSizeLimit in (Compile, scalaxb) := 20

namedAttributes in (Compile, scalaxb) := true

Related, 1.3.0 fixes attribute's default value handling #288.


Thanks to YourKit for supporting scalaxb! YourKit Java Profiler works great for profiling Scala applications.

scalaxb with Scala 2.11

Starting scalaxb 1.2.0 it supports Scala 2.11.x. Since Scala 2.11 modularizes XML and parser combinators, it requires additional setup on your part. Here's using sbt 0.13's multi-project build.sbt syntax:

import ScalaxbKeys._
lazy val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.0.2"
lazy val scalaParser = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1"
lazy val dispatchV = "0.11.2" // change this to appropriate dispatch version
lazy val dispatch = "net.databinder.dispatch" %% "dispatch-core" % dispatchV
lazy val root = (project in file(".")).

scalaxb 1.2.1

This is a bug fix release focused on fixing the SOAP code generation. See using SOAP for more details.

SOAP bug fixes

  • Fixes xs:AnyType handling. #265
  • Fixes asFault not Throwable error. #264 reported by @romainreuillon
  • Fixes the generated code for multipart SOAP message. #267 reported by @tomhaigh
  • Fixes the definition of HttpClientsAsync to use concurrent.Future. #269 reported by @hedefalk
  • Adds --blocking command line option to generate blocking SOAP client.

minor enhancements

  • Masks scalaxb package that's used internally to generate code.
Syndicate content