Groovy WebServices for Groovy 1.8 (Groovy-wslite) for N4 2.5 and later

N4 2.5 and later use Java 7 and the opensource library GroovyWS is not supported on Java 7.  We are forced to switch to using a new library called groovy-wslite.  This new library has fewer cross dependencies but also requires a deeper understanding of the SOAP protocol.  It also claims to support REST.

If you were using the older style of webservices you will need to migrate your code.

For details and further examples see https://github.com/jwagenleitner/groovy-wslite (http://www.).

 

Groovy code example

import wslite.soap.*

 

public class WebserviceTest {

 

  public String execute() {

    println "Entering callWebservice method";

    def client = new SOAPClient('http://www.holidaywebservice.com/Holidays/US/Dates/USHolidayDates.asmx')

    def response = client.send(SOAPAction: 'http://www.27seconds.com/Holidays/US/Dates/GetMothersDay') {

      body {

        GetMothersDay('xmlns': 'http://www.27seconds.com/Holidays/US/Dates/') {

          year(2011)

        }

      }

    }

 

    String result = response.GetMothersDayResponse.GetMothersDayResult.text()

    assert "2011-05-08T00:00:00" == result

    assert 200 == response.httpResponse.statusCode

    assert "ASP.NET" == response.httpResponse.headers['X-Powered-By']

 

    println "Leaving callWebservice method: Result="+result;

    return result;

  }

}