Description
The Wsclient plugin adds a remoting client capable of communicating via SOAP. It is compatible with Grails' Xfire plugin 0.8.1.
Installation
The current version of griffon-wsclient-plugin is 0.5
To install just issue the following command
Usage
The plugin will inject the following dynamic methods:
- withWs(Map params, Closure stmts) - executes
stmtsissuing SOAP calls to a remote server. - withWs(Map params, CallableWithArgs<T> stmts) - executes
stmtsissuing SOAP calls to a remote server.
Where params may contain
Property |
Type |
Required |
Notes |
|---|---|---|---|
wsdl |
String |
|
WSDL location |
soapVersion |
String |
|
either "1.1" or "1.2". Defaults to "1.1" |
classLoader |
ClassLoader |
|
classLoader used for proxy classes |
timeout |
long |
|
|
mtom |
boolean |
|
enable mtom |
basicAuth |
Map |
|
must define values for |
proxy |
Map |
|
proxy settings. Keys must match |
ssl |
Map |
|
ssl settings, Keys must match |
These methods are also accessible to any component through the singleton griffon.plugins.wsclient.WsclientConnector. You can inject these methods to non-artifacts via metaclasses. Simply grab hold of a particular metaclass and call WsclientConnector.enhance(metaClassInstance).
Examples
This example relies on Grails as the service provider. Follow these steps to configure the service on the Grails side:
- Download a copy of Grails and install it.
- Create a new Grails application. We'll pick 'exporter' as the application name.
- Change into the application's directory. Install the xfire plugin.
- Create a MathService
grails-app/services/MathService.groovy
- Start the application
Now we're ready to build the Griffon application
- Create a new Griffon application. We'll pick MathClient as the name
- Install the wsclient plugin
- Fix the view script to look like this
griffon-app/views/MathClientView.groovy
- Let's add required properties to the model
griffon-app/models/MathClientModel.groovy
- Now for the controller code. Notice that there is minimal error handling in place. If the user types something that is not a number the client will surely break, but the code is sufficient for now.
griffon-app/controllers/MathClientController.groovy
- Start the application
All dynamic methods will create a new client when invoked unless you define an id: attribute. When this attribute is supplied the client will be stored as a property on the instance's metaClass. You will be able to access it via regular property access or using the id: again.
Configuration
Dynamic method injection
Dynamic methods will be added to controllers by default. You can change this setting by adding a configuration flag in Config.groovy
History
Version |
Date |
Notes |
|---|---|---|
0.5 |
12-08-11 |
Release sync with Griffon 0.9.4 |
0.4.2 |
05-23-11 |
Release sync with Griffon 0.9.2 |
0.4.1 |
11-08-10 |
Fix a metaclass problem when injecting dynamic methods |
0.4 |
10-27-10 |
Release sync with Griffon 0.9.1 |
0.3.1 |
08-12-10 |
Fixed GRIFFON-233 |
0.3 |
07-22-10 |
Release sync with Griffon 0.9 |
0.2.1 |
03-15-10 |
Fixed GRIFFON-149 |
0.2 |
03-01-10 |
Upgraded to Griffon 0.3 |
0.1 |
10-26-09 |
Initial release |