Created
March 3, 2011 06:29
-
-
Save maxaf/852430 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Dump contents of http://www.w3.org/2003/05/soap-envelope/ to soap12.xsd | |
and put that somewhere alongside the other schemas. | |
2. Run scalaxb, you'll end up with a soap12.scala & company. | |
3. See sample code. Call envXml and get back XML representation of envelope, | |
header, and body all in one. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def messageID = <wsaddr:MessageID>{ "messageID:%d".format((System.currentTimeMillis / 1000 - scala.util.Random.nextInt.abs).abs.intValue) }</wsaddr:MessageID> | |
def header = Header(Seq(DataRecord(<wsaddr:To>...</wsaddr:To>), | |
DataRecord(messageID), | |
DataRecord(<wsaddr:Action>...</wsaddr:Action>)), Map.empty) | |
def envelope = Envelope(Some(header), Body(Seq(DataRecord(bodyXml)), Map.empty), Map.empty) | |
def envXml = toXML[Envelope](envelope, Some("http://www.w3.org/2003/05/soap-envelope"), Some("Envelope"), defaultScope) | |
def bodyXml: NodeSeq = /* some way to return actual domain-specific XML that goes under <Body> */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment