This plugin allows Grails developers to expose methods defined in Grails Service classes as Web Services. The latest version of the plugin is 0.6. This version supports Grails v1.1.
NOTE:
Please use version 0.5 for Grails 1.0.4 and earlier versions.
Alternatively, you can use the following command, if you have a plugin archive locally.
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.
You can use Java or Groovy classes (including domain classes) as parameters and return types.After running the application (grails run-app), the EPR of the web service will be:
And the WSDL will be available at:
You can browse the Axis2 web interface at:
Installation
Type the following command in your Grails application directory to install Apache Axis2 plugin.$> grails install-plugin axis2
$> grails install-plugin /path/to/grails-axis2-<version>.zip
Dependencies
This plugin is based on the WSO2 WSF/Spring framework, which integrates the Apache Axis2 Web services engine into Spring.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']import javax.jws.WebParam;class TestService { static expose=['axis2'] String sayHello(String yourName) { return "Hello ${yourName}!" } def availableBooks() { return Book.list() } Book getBookById(int id) { return Book.get(id) } void addBook(@WebParam(name="name")String pName, @WebParam(name="author")String pAuthor) { new Book(name:pName, auther:pAuthor).save(); } }
http://localhost:8080/my-project/services/test
http://localhost:8080/my-project/services/test?wsdl
http://localhost:8080/my-project/axis2-web/
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.6- Supports Grails 1.1
- Updated to WSF/Spring v1.5
- Partial support for @WebParam annotation ('name' attribute)
- Groovy classes (including Grails domain classes) for parameters and return values.
- Grails v1.0.1 support
- Minor changes and bug fixes
- Initial release


No Comments Yet
Post a Comment
Site Login