Skip to content

Instantly share code, notes, and snippets.

@rhart
Last active April 5, 2016 14:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rhart/6812421 to your computer and use it in GitHub Desktop.
Save rhart/6812421 to your computer and use it in GitHub Desktop.
Ratpack SOAP web service
import static org.ratpackframework.groovy.RatpackScript.ratpack
import static org.ratpackframework.groovy.Template.groovyTemplate
ratpack {
handlers {
prefix('say-hello-service') {
soapAction('"Hello"') {
def soapRequest = new XmlSlurper().parseText(request.text)
def yourFirstName = soapRequest.Body.HelloRequest.FirstName
render groovyTemplate('sayHelloResponse.xml', greeting: "Hello $yourFirstName!")
}
}
assets 'public'
}
}
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hel="http://anacoders.com/helloService/">
<soapenv:Body>
<hel:HelloResponse>
<Greeting>${model.greeting}</Greeting>
</hel:HelloResponse>
</soapenv:Body>
</soapenv:Envelope>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment