Deprecated Garbage Collections – Kenny Lee Chee Wei

A truckload of garbage by Kenny Lee Chee Wei

Groovy Web Service Client (GroovyWS)

with 4 comments

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) .

Written by Kenny Lee

January 2, 2008 at 8:03 am

Posted in Groovy

4 Responses

Subscribe to comments with RSS.

  1. That is exactly how complex a client should be. Java web service clients have been too complex in the past. It doesn’t help that in the past vendors (I’m looking at you BEA) always liked to pile on their cruft to make life (cough, cough) easier :)

    Scott

    July 18, 2008 at 5:28 pm

    • Let’s see you some message level encryption via WS-Security used on this call and see how simple it remains.

      Jake

      June 16, 2009 at 11:36 am

  2. these are just toy programs .

    jignesh

    January 7, 2009 at 9:17 am

  3. Following script is generated with SoamMoa
    See soamoa.org

    /* Generated GroovyWS Script by SoaMoa, :ridvan at Thu Oct 08 23:14:13 CEST 2009 */

    import groovyx.net.ws.WSClient

    def proxy = new WSClient(“http://www.webservicex.net/CurrencyConvertor.asmx?WSDL”, this.class.classLoader)
    proxy.create()
    def conversionRateResponse = proxy.ConversionRate(‘USD’, ‘EUR’)
    assert (conversionRateResponse == 0.676)

    soamoa-fan

    October 8, 2009 at 9:16 pm


Leave a Reply