Metro Plugin for Grails Framework

Metro plugin allows applications developed with Grails framework to expose service classes as SOAP Web Services. It uses the SOAP implementation from Metro web service stack, which includes JAX-WS.

How to Install

Download the plugin (links below), and in your grails application directory, invoke:
grails install-plugin

How to Use

  1. In grails application directory, invoke:
    grails create-service Calculator
    which creates class grails-app/services/CalculatorService.groovy

  • Implement your methods, e.g. add, multiply, and annotate the class with @WebService, @WebMethod annotations. The resulting class should look like below:
    import javax.jws.*
    class CalculatorService {
        def int add(int i, int j) {
            return i+j;
        def multiply(int i, int j) {
            return i*j;
  • Run your application, using
    grails run-app
  • Test if your service is deployed, by pointing your browser to:
  • Note that the targetNamespace attribute is required only for classes in default package. If your classes are specified in a package, the targetNamespace value is defaulted based on package name and doesn't need to be specified explicitly.

    How it works

    The plugin uses Jax-ws spring integration. When the grails application is executed, classes are scanned for @WebService annotations. If such annotation is present, appropriate entries are generated to grails-app/conf/spring/resources.xml, and wsgen is called to generate required classes.

    Another option is to specify web service classes in web-app/WEB-INF/sun-jaxws.xml file. If the file exists, only entries in the file are used to generate entries in resources.xml or web.xml. No other classes are scanned for presence of @WebService annotations.


    Version Changes
    1.0.2DownloadIncluded patch from Alex Peters - fixes issue with web services in packages.
    1.0.1DownloadFixed problem with services dependency. Updated for Grails 1.0.3.


    Sources are stored in Subversion. Read more
    Terms of Use; Privacy Policy; Copyright ©2013-2015 (revision 20150925.bf86fa7)
    Please Confirm