Archive for the ‘Groovy’ Category
Groovy Web Service Client (GroovyWS)
Here’s 2 examples of how simple groovy web service clients can be. You will need to download a groovy lib jar from the GroovyWS Home Site. Basically it just creates the classes dynamically on-the-fly instead of creating stubs.
1. CurrencyConvertor
import groovyx.net.ws.WSClient
proxy = new WSClient("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL", this.class.classLoader)
//'USD', 'EUR', 'CAD', 'GBP', 'AUD', 'SGD'
rate = proxy.ConversionRate('SGD','USD')
print rate
2. Stock Quote
import groovyx.net.ws.WSClient
proxy = new WSClient("http://www.webservicex.net/stockquote.asmx?WSDL", this.class.classLoader)
quote = proxy.GetQuote('GOOG')
print quote
Read Geertjan’s groovy_web_service for more info (Swing).
Read the official Groovy Web Service Doc for more info (Groovy WS) .