Posts

scalaxb 1.1.2

bug fixes and minor enhancements

  • Fixes blank xs:enumeration value generating broken case object. #220 reported by @FranklinChen and others.
  • Fixes generated field for an attribute named value conflicting with the value field for xs:simpleContent. #221 reported by @lyle-janrain

scalaxb 1.1.1

breaking change to commandline

scalaxb cli used -p and --package to specify both the default package name and namespace-specific package names. scalaxb 1.1.1 uses -p and --default-package for the default package; and --package for namespace-specific package names.

bug fixes and minor enhancements

  • Avoids type names that only differs in case. #215 reported by @drdozer

  • Fixes handling of xs:all with minOccurs=0 and nillable. #216 reported by @minettiandrea

  • Fixes xsi:nil="1" not parsed as nil. #217 reported by @aoprisan

  • Improves handling of chameleon schema. #102

  • Configures dispatchVersion to 0.10.1 by default.

  • Updates sbt-scalaxb for sbt 0.13.

scalaxb 1.1.0

breaking changes

  • scalaxb now generates sys.error, so the generated code will no longer be compilable under Scala 2.8. #115 reported by @idot and others.

dispatchVersion

A new key dispatchVersion was added to generate Dispatch 0.10.x compatible code #210:

dispatchVersion in scalaxb in Compile := "0.10.0"

libraryDependencies <+=(dispatchVersion in scalaxb in Compile) { dv =>
  "net.databinder.dispatch" %% "dispatch-core" % dv
}

bug fixes and minor enhancements

  • Includes offending data in ParserFailure message. #206 requested by @caoilte

  • Fixes handling of QName enums. #208

  • sbt-scalaxb sorts *.xsd to avoid platform variance. #207 reported by @caoilte

  • sbt-scalaxb generates code only when the xsd files are modified. #199 requested by @fommil

scalaxb 1.0.2

bug fixes

  • Fixes handling of large groups. #188 reported by @workingDog

  • Fixes handling of xs:any with namespace constraints. #189

  • Removes upper limit on duplicate name resolution. #190

  • Fixes handling of enum values that are symbols. #191

  • Fixes xs:group references naming conflict. #192

  • Fixes handling of xs:choice that’s made up of a foreign type. #193

  • Fixes handling of split xs:sequence whose only item is nillable and unbounded. #194

  • Fixes handling of xs:choice that includes a substitution group. #195

  • Fixes handling of complex types containing foreign xs:sequence. #196

  • Fixes handling of xs:group or a mixed complex type that includes an optional substitution group. #197

  • Fixes handling of complex types that directly or indirectly derives from xs:anySimpleType. #200/#203 reported by @sagarcjoshi

  • Fixes handling of mixed complex type that extends simple type. #205

  • Fixes DispatchHttpClients not handling non-200 results. reported and fixed by @dportabella in #204

scalaxb 1.0.0

This is the first stable release of scalaxb. Thanks to many people who tried it out, reported bugs, and contributed ideas and code.

breaking changes since 0.7

Some changes were made to adapt to Scala 2.10.0.

  • To avoid implicit conflict, the scalaxb package object no longer extends XMLStandardTypes.
  • scalaxb.XMLStandardTypes object was added to support explicitly importing implicits.
  • HexBinary class and Base64Binary class’s toIndexedSeq method is now a field named vector.
  • The default http client for SOAP binding is upgraded to Dispatch 0.9.5.

bug fixes and minor enhancements

  • Fixes typo in element form check (“qualified”) #168. Fixed by @mprihoda

  • More lenient handling of base64Binary encoding #173. Requested by @nmccready

  • Fixes generated code for named groups containing nillable choices #162. Reported by @rajish

  • Fixes attribute merging across namespace #174. Reporetd by @sbrownyarris

  • Fixes handling of chameleon schemas #176. Reported by @Marza

  • Fixes grandchildren types missing from generated XMLFormat of traits #178. Reported by @kidasoft

  • Fixes xs:boolean parsing #179. Fixed by @rssh

scalaxb 1.0.0-RC3

bug fixes and minor enhancements

  • Fixes generated code for named groups containing nillable choices. #162 reported by @rajish

  • Fixes attribute merging across namespace. #174 reporetd by @sbrownyarris

  • Fixes handling of chameleon schemas. #176 reported by @Marza

  • Fixes grandchildren types missing from generated XMLFormat of traits. #178 reported by @kidasoft

scalaxb 1.0.0-RC1

This is a release candidate for the first stable release of scalaxb.

breaking changes since 0.7

Some changes were made to adapt to Scala 2.10.0-RC1.

  • To avoid implicit conflict, the scalaxb package object no longer extends XMLStandardTypes.
  • scalaxb.XMLStandardTypes object was added to support explicitly importing implicits.
  • HexBinary class and Base64Binary class’s toIndexedSeq method is now a field named vector.
  • The default http client for SOAP binding is upgraded to Dispatch 0.9.2.

bug fixes and minor enhancements

  • Fixes typo in element form check (“qualified”) #168. Fixed by @mprihoda

scalaxb 0.7.2

new logger

@martiell contributed a log4j wrapper that replaces logula. #161. The main change is that our resolver is down to Sonatype:

resolvers += "sonatype-public" at "https://oss.sonatype.org/content/groups/public"

bug fixes and minor enhancements

  • Adds support for resolving SOAP encoding hrefs. #160. reported by @greenrd

  • Fixes xsi:type attribute wiping out other attributes due to SI-5843 #159. reported by @psnively

  • Fixes reserve word escaping when names contain trailing whitespaces. #163. reported by @dohzya

scalaxb 0.7.1

bug fixes and minor enhancements

  • Fixes RPC style soap. #153

  • Fixes generated code for imported groups. #156

scalaxb 0.7.0

Additional resolvers required

The logger is changed to logula. For sbt-scalaxb, additional resolvers are now required:

resolvers ++= Seq(
  "sonatype-public" at "https://oss.sonatype.org/content/groups/public",
  "repo.codahale.com" at "http://repo.codahale.com")

addSbtPlugin("org.scalaxb" % "sbt-scalaxb" % "0.7.0")

bug fixes and minor enhancements

  • Fixes inner simple types being detected as duplicates. #136 reported by @bampoosa
  • Adds a few missing settings to sbt-scalaxb. #144 reported by @devinus
  • Fixes xs:any namespace attribute not defaulting to ##any. #147 reported by @champloo
  • Fixes soap 1.2 output wrapper. #143
  • Fixes handling of wsdl with mixed complex type. #149 reported by @jcranky
  • Fixes handling of wsdl with header outputs. #150 reported by @jcranky

mvn-scalaxb

  • mvn-scalaxb was updated by @martiell

  • Updated for deployment to Sonatype open source repository hosting.

  • M2E 1.1 compatible: no longer requires an m2e connector plugin or lifecycle mapping metadata in the pom.xml when used with m2eclipse 1.1.

  • Don’t swallow stack traces when propagating exceptions from scalaxb.

multiple configs

A few people have asked me on how to configure a sbt build so scalaxb can be used multiple times, so let’s take a look. Here’s the code:

$ git clone -b multipleconfigs git://github.com/eed3si9n/scalaxb-sample.git
$ cd scalaxb-sample/multipleconfigs/

Now open the directory using your favorite editor.

In src/ we have main/scala/main.scala, main/xsd/ipo.xsd, and main/xsd/w.xsd.

when to go multiple configs?

With the single config approach, the xmlprotocol.scala contains the typeclass instances for all schemas. It’s currently necessary to compile all referenced schemas together, so normally that’s the route you should take.

scalaxb 0.6.8

bug fixes and minor enhancements

  • Fixes handling of cross-namespace extension. #135 reported by @psnively

  • Fixes parsing to reject extra elements at the end. #124

  • Relaxes wsdl parsing to handle out-of-order wsdls. #87

  • wsdl generates baseAddress as a def. #134 by @hedefalk

scalaxb 0.6.7

bug fixes and minor enhancements

  • Adds support for merging duplicate simple types. #116 reported by @OlegYch

  • Fixes substitution group parsing. #119 reported by @bmjsmith and #133 reported by @psnively

  • Fixes DataRecord equality. #120 reported by @deanhiller

  • Fixes package name of wsdl generated file. #117 reported by @hedefalk and @OlegYch

  • Fixes handling of empty input messages in wsdl. #122 reported by @hedefalk

  • Fixes handling of varg parameters in wsdl generated file. #125 reported by @hedefalk

  • Fixes simultaneous use of soap 1.1 and soap 1.2. #130 reported by @ben-manes

  • Fixes wsdl protocol package name.

scalaxb 0.6.6

bug fixes and minor enhancements

  • scalaxb changes were made by @eed3si9n
  • Fixes generated default scope by adding back the default namespace. #91 reported by @martiell
  • Fixes toXML handling of xs:anyAttribute. #95 reported by @deanhiller
  • Fixes generated defaultScope when the schema is unqualified. #97 reported by @deanhiller
  • Fixes xs:any repeating namespace bindings by merging them. #98 reported by @deanhiller
  • Fixes handling of xs:any with namespace="##local". #101 reported by @deanhiller
  • Adds --lax-any to ignore xs:any’s namespace constraint. #103 requested by @deanhiller
  • Adds --version to display help message. #106 requested by @deanhiller
  • Adds --attribute-prefix to prefix parameters mapping an attribute. #92 reported by ido
  • Adds handling of xs:include without targetNamespace. #102 reported by @berntan
  • Adds handling of locally declared namespace binding. #105 reporetd by gerri
  • Fixes round trip of parsed QName. #114
  • Adds default argument to optional, multiple, and nillable params. #113 requested by @OlegYch
  • Fixes handling of wsdl when soap bindings is not the first element. #104
  • Adds handling of soap messages with attributes. #99 reported by @berntan
  • Adds handling of soap messages with soap headers. #100 reported by @berntan
  • sbt-scalaxb and mvn-scalaxb processes wsdl first.
  • Fixes handling of wsdl with empty messages. #93 reported by @mbroue
  • Fixes handling of rpc-style return message on soap 1.1. #94 reported by @dkhenry

mvn-scalaxb

scalaxb 0.6.5

breaking changes

In an effort to solve namespace conflicts and to increase consistency among the plugins, sbt plugins best practices was created. Here are the changes based on its recommendations:

keys are under ScalaxbKeys object

Keys provided by sbt-scalaxb now resides in ScalaxbKeys object. Place the following at the top of your build.sbt:

import ScalaxbKeys._

Scala identifiers for the keys remain the same (e.g. packageName), but key names accessible from the shell are now prefixed with scalaxb- (e.g. scalaxb-package-name).

settings are scoped under scalaxb task

scalaxb-specific settings are now scoped under scalaxb task. The default settings scalaxbSettings is scoped additionally by Compile configuration (no moreScalaxb configuration!).

seq(scalaxbSettings: _*)

packageName in scalaxb in Compile := "ipo"

sourceGenerators in Compile <+= scalaxb in Compile

If you wish to use scalaxb task multiple times in a project, you can do so by creating custom configurations in build.scala.

val Xsd = config("xsd") extend(Compile)
val Wsdl = config("wsdl") extend(Compile)
lazy val appSettings = buildSettings ++
  inConfig(Xsd)(baseScalaxbSettings ++ inTask(scalaxb)(customScalaxbSettings("xmlschema"))) ++
  inConfig(Wsdl)(baseScalaxbSettings ++ inTask(scalaxb)(customScalaxbSettings("wsdl11")))

def customScalaxbSettings(base: String): Seq[Project.Setting[_]] = Seq(
  sources <<= xsdSource map { xsd => Seq(xsd / (base + ".xsd")) },
  packageName := base,
)

bug fixes and minor enhancements

  • Fixes namespace binding conflict. #84 reported and fixed by jxstanford
  • Fixes anyType support in wsdl. #88 reported by radirk
  • Fixes SOAPAction header in wsdl.
  • Fixes Fault handling in wsdl.
  • Uses Logback internally for logging.

scalaxb 0.6.4

bug fixes and minor enhancements

  • Fixes sbt-scalaxb. #83
  • Fixes QName parsing to resolve URI. #82

scalaxb 0.6.3

bug fixes and minor enhancements

  • Fixes xs:gMonthDay support. #74
  • Fixes substitution group parsing. #79 reported by @jxstanford
  • Fixes SOAP 1.2 Content-Type HTTP header. #80
  • Adds RPC-style SOAP message support. #77
  • Changes the default protocol file name to xmlprotocol.scala.
  • Adds --protocol-file and --protocol-package option. #76
  • Duplicated types are now ignored. #78 requested by @timperrett

scalaxb 0.6.2

sbt-scalaxb for sbt 0.10.1

To call scalaxb from sbt 0.10.1, put this in your project/plugins/build.sbt:

libraryDependencies <+= (sbtVersion) { sv => "org.scalaxb" %% "sbt-scalaxb" % ("sbt" + sv + "_0.6.2") }

and this in build.sbt:

seq(sbtscalaxb.Plugin.scalaxbSettings: _*)

sourceGenerators in Compile <+= scalaxb.identity

bug fixes and minor enhancements

  • Adds --contents-limit option to set the limit of long sequence.
  • Adds --prepend-family option to prepend family name to classes generated from child elements (#69 reported by @devinus).
  • Adds soap 1.1 support (#66 reported by @s_m_stewart and @meglio)
  • All modules built using sbt 0.10.1.

wsdl feature the beginning

I wanted to share Tim’s latest blog article Using SOAP with Scala with you guys.

It seems I have inadvertently become “that guy who does SOAP with Scala”.

Also wanted to share a bit of the background. I’d known SOAP was doable because majority of the WSDL is actually XSD, and also @max4f has implemented it. But originally, I was going to wait a while till I implement WSDL/SOAP support. What got me moving quicker was @timperrett’s tweet on 4/26:

Has anyone ever built some kind of monadic abstraction on SOAP? If so, i want to hear your thoughts!

scalaxb 0.6.1

goodbye sbaz, hello conscript

sbaz allowed quick installation of scalaxb, but it also had its share of problems like scala version dependencies and contaminating the REPL classpath. Starting 0.6.1, scalaxb will no longer be supporting sbaz and recommend all users to switch to conscript for installing scalaxb.

$ sudo sbaz remove scalaxb
$ cs eed3si9n/scalaxb

no Array

  • xs:base64Binary now maps to scalaxb.Base64Binary instead of Array[Byte].
  • Both scalaxb.HexBinary and scalaxb.Base64Binary are backed by Vector[Byte] internally.
  • Other built-in types that previously mapped to Array[String] now maps to Seq[String].

mvn-scalaxb

scalaxb plugin for Maven was contributed by @martiell.

sbt-scalaxb for sbt 0.10

To call scalaxb from sbt 0.10, put this in your project/plugins/build.sbt:

libraryDependencies += "org.scalaxb" %% "sbt-scalaxb" % "0.6.1"

and this in your build.sbt:

sourceGenerators in Compile <+= scalaxb.identity

bug fixes and minor enhancements

  • Fixes list derived types (#54 reported by @ikwzm).
  • Fixes handling of empty sequences (#55).
  • Fixes naming of local elements with duplicate name and structure (#56).
  • Adds @implicitNotFound attributes on fromXML etc.
  • Adds --no-runtime option to skip generating scalaxb.scala (#45 requested by @martiell).
  • Implements camel casing of wsdl operation name (#52 requested by @timperrett).
  • Removes X prefix on wsdl message case classes (#51 requested by @timperrett).
  • Adds --chunk-size option to handle 200+ parameters (#58 reported by @ecin).

scalaxb 0.6.0

new feature

bug fixes and other minor enhancements

  • XML bindings are generated as foo_xmlprotocol.scala.

  • Uses Scala 2.9.0-1.

  • Web API uses Unfiltered 0.3.3.

  • Adds default argument for xs:anyAttribute.

  • Adds support for xs:anySimpleType. (#34 reported by @psnively)

  • Fixes xs:any naming. (#35 reported by @psnively)

  • Adds typeclass instance for DataRecord. (#40 reported by @psnively)

  • Fixes DataRecord round trip. (#43)

  • Fixes mapping of xs:choice of xs:anyType. (#44 reported by @psnively)

wsdl 1.1 support

During the .com boom, everyone has written a SOAP service or two, which were typically cataloged using WSDL. If you study a WSDL document, you’ll discover that a good portion of the document is actually embedded XML Schema document describing the layout of the messages sent back and forth. The rest are details. Since scalaxb is handling the XML Schema, it was only matter of time to extend this into supporting WSDL.

scalaxb 0.5.4

  • Added sbt-scalaxb plugin by @max4f.

  • Added --package-dir, which generates package directory structure.

  • scalaxb is now available via conscript: cs eed3si9n/scalaxb.

  • Fixes generated code for cross-package choices (GH-33).

sbt-scalaxb is in the house

A big thanks to Max (@max4f) for writing a scalaxb plugin for sbt, and letting me pull it into the project. If you’re not using simple build tool, why?

Here are the steps to compile-xsd task from sbt.

step 1. Plugins.scala

Add the following to your project/plugins/Plugins.scala.

import sbt._

class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
  val scalaxb = "org.scalaxb" % "sbt-scalaxb" % "0.6.0"
  
  val scalaToolsNexusSnapshots = "Scala Tools Nexus Snapshots" at "http://nexus.scala-tools.org/content/repositories/snapshots/"
  val scalaToolsNexusReleases  = "Scala Tools Nexus Releases" at "http://nexus.scala-tools.org/content/repositories/releases/"
}

scalaxb 0.5.3

breaking changes (no import)

  • Moved helper functions from Scalaxb object into scalaxb package object.
  • Moved default typeclass instances from DefaultXMLProtocol trait to the package object of the generated class. (inspired by @jsuereth at #nescala)

Before:

import scalaxb._
import Scalaxb._
import ipo._
import DefaultXMLProtocol._
val shipTo = fromXML[Address](subject)

After:

val shipTo = scalaxb.fromXML[ipo.Address](subject)

bug fixes and minor enhancements

  • Maps xs:integer, etc. to BigInt.

  • Fixed substitution group parsing (GH-25 reported by @dbolene)

  • Implements attributeFormDefault, elementFormDefault, and form support. (GH-26 reported by @dbolene)

  • Fixed parsing long sequence. (GH-29 reported by E-Fir)

  • Implements UTF-8 and UTF-16 BOM handling. (GH-31 reported by @fredferrao)

  • Prints version number. (GH-24 requested by @dbolene)

  • Prints better parser error message. (GH-27 reported by @dbolene)