XOE Developers Guide v1.0: A guide to application development within the XOE framework | ||
---|---|---|
Prev | Chapter 14. SOAP and XOE SOAP server | Next |
The XOE Lightweight Simple Soap Server (XOE package name "simple-soap-server") is an extension of the SOAP service that allows a XOE framework to listen for incoming soap requests.
The simple-soap-server package depends on both the mime package and the soap package.
--->mime | ^ soap | ^ | | | simple-soap-server
The mime package is not a service. It is a collection of objects that can parse inputstreams into mime attachments. For more information, please refer to the javadocs for org.xoe.mime.
The XOE SOAP Service complies with "SOAP Version 1.1" specification as well as "SOAP Messages with Attachments."
This document assumes that the reader understands the following specifications:
Table 14-2.
W3C SOAP Version 1.1 | http://www.w3.org/TR/SOAP |
W3C SOAP Messages with Attachments | http://www.w3.org/TR/SOAP-attachments |
Apache SOAP project | http://xml.apache.org/soap/index.html |
The Lightweight Soap Server can be run as a XOE application or as a Stand Alone Server. "Stand Alone" is a bit of a misnomer. What "Stand Alone" really means is that the Soap Server can be configured from outside the XOE package. The server is a XOE application regardless of whether it is run in Stand Alone Mode or not. But XOE applications are designed to not save information to the file system by default. So if a developer wished to run a Lightweight Soap Server as a desktop machine application, this would be more easily done by running it in Stand Alone Mode.
The SimpleSoapServer should be accessed through it's interface, ISimpleSoapServer. All the necessary methods to administer the server are provided on this interface. Services provided by the server are held in the SimpleSoapServerRegistry, which is essentially a hash of services and their unique identifiers. The networking layer of the server is handled by the SimpleSoapServerRegistry.
ISimpleSoapServer contains the following methods. Access to these methods are all that a developer should need to administer a Soap Server on a XOE device:
listen()
shutdown()
getCurrentPort()
isRunning()
registerService()
lookupService()
getServiceTable()
getStandAloneMode()
getStandAloneWorkingDir()
The Lightweight Soap Server package comes with a simple XOE application that provides a front end gui to admister the server. Currently there is no interactive way to add services to the server. If a developer wants to add a service to the Soap Server, the following steps need to be taken:
Add a class to your package that implements org.xoe.core.packages.InstallScript
Inside the postInstall() method add the following code:
ISimpleSoapServer ssServer; ssServer = (ISimpleSoapServer) ServiceLocator.findImplementor (ISimpleSoapServer.INTERFACE); MyNewSoapService myNewSoapService = new MyNewSoapService (); ssServer.registerService ( myNewSoapService.SERVICE_ID, myNewSoapService);
Add a file called scripts.xml and put it in the resource folder of your package. Inside the file, add the following xml:
<custom-script>my.package.MyNewSoapService</custom-script>
When XOE boots up, MyNewSoapPackage will be automatically installed and registered with the SimpleSoapServer. For an example of this functionality, take a look at the sync-server XOE package.