Tuesday, March 29, 2011

groovyWS

@Grab(group='org.codehaus.groovy.modules', module='groovyws', version='0.5.2') // may take a while to download all dependencies!
import groovyx.net.ws.WSClient

proxy = new WSClient("http://www.w3schools.com/webservices/tempconvert.asmx?WSDL", this.class.classLoader)
proxy.initialize()

result = proxy.CelsiusToFahrenheit(0)
println "You are probably freezing at ${result} degrees Farhenheit"

http://groovyconsole.appspot.com/script/451004

Updated (just for fun...)

@Grab(group='org.codehaus.groovy.modules', module='groovyws', version='0.5.2')
import groovyx.net.ws.WSClient

proxy = new WSClient("http://www.w3schools.com/webservices/tempconvert.asmx?WSDL", this.class.classLoader)
proxy.initialize()

(-15..40).step(5) { i ->
    result = proxy.CelsiusToFahrenheit(i)
    println "${i} Celcius == ${result} Farhenheit"
}

No comments:

Post a Comment