Led & Sustained by

G2one Logo

Developed with

Intellij

Powered by

Spring

Apache Axis2 Plugin

This plugin allows Grails developers to expose methods defined in Grails Service classes as Web Services. The latest version of the plugin is 0.2. This version supports Grails v1.0.x.

Installation

 

Type the following command in your Grails application directory to install Apache Axis2 plugin.

$> grails install-plugin axis2

Alternatively, you can use the following command, if you have a plugin archive locally.

$> grails install-plugin /path/to/grails-axis2-<version>.zip

Dependencies

 

This plugin depends on WSO2 WSF/Spring, which integrates the Apache Axis2 Web services engine into Spring. All the dependent JAR files are included in the plugin.

Getting Started

Just add the following line to a Grails service class to expose is as a web service. This will expose all the methods of the service class as web service operations.

 

static expose=['axis2']

 

For more information on service classes refer to the section on Services in the Grails user guide.

 

The following code illustrates a sample service class exposed as an Apache Axis2 web service.

 

class TestService {

    static expose=['axis2']

    String sayHello(String yourName) {
        return "Hello ${yourName}!"
    }
}

You can use Java or Groovy classes (including domain classes) as parameters/return types.

After running the application (grails run-app), the EPR of the web service will be:

http://localhost:8080/your_app_name/services/test

 

And the WSDL will be available at:

http://localhost:8080/your_app_name/services/test?wsdl

 

You can browse the Axis2 web interface at:

http://localhost:8080/your_app_name/axis2-web/ 

 

Here is another example:

import javax.jws.WebService
import javax.jws.WebMethod
import javax.jws.WebParam

@WebService(name="MyWebService", targetNamespace = "http://eranga.info")
class TestService2 {

    static expose=['axis2']

    @WebMethod(operationName = "sayHello", action = "urn:sayHello")
    String mymethod(@WebParam(name = "yourname") String myparam) {
        return "Hello ${myparam}!"
    }

    @WebMethod(exclude=true)
    def privateMethod() {
        // This method will not be exposed
    }
}

Roadmap

The following features are planned to implement in the near future.

  • Custom WSDLs
  • WS-* support

Source Code

This source code is available at http://svn.codehaus.org/grails-plugins/grails-axis2/.

Report Bugs

Please use JIRA issue tracker available at http://jira.codehaus.org/secure/CreateIssue!default.jspa. Report the bugs under the "Grails-axis2" component of the "Grails Plugins" project. If you do not have an exsisting JIRA account, please sign up at http://jira.codehaus.org/secure/Signup!default.jspa.

Version History

v. 0.2

  • Using Groovy classes (including Grails domain classes) for parameters and return values.

v. 0.1.2

  • Grails v1.0.1 support

v. 0.1.1

  • Minor changes and bug fixes

v. 0.1

  • Initial release
</