Last updated by erangaj 2 years ago
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.1. This version supports Grails v1.1.
NOTE:
Please use
version 0.5 for Grails 1.0.4 and earlier versions.
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 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.
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.
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();
}
}
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:
http://localhost:8080/my-project/services/test
And the WSDL will be available at:
http://localhost:8080/my-project/services/test?wsdl
You can browse the Axis2 web interface at:
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.1
v. 0.6
v. 0.5
- Updated to WSF/Spring v1.5
- Partial support for @WebParam annotation ('name' attribute)
v. 0.2
- Groovy classes (including Grails domain classes) for parameters and return values.
v. 0.1.2
v. 0.1.1
- Minor changes and bug fixes
v. 0.1