| Web Services Module |
|
Web Services Module The Web Service Module allow you to publish and talk to services using objects over the web, using SOAP, in a language neutral manner. This module lets you automate the Publishing of your Enterprise as Web Services. This tutorial assumes you know what web services is all about. If you don't then we suggest you download the GLUE web services toolkit and go through its user guide. It should get you up to speed and publishing classes within minutes. In order to use the Web Services module you need to include the following writer: $GENERATOR.AggregateWriter webservice The WebService writers create several files.
The files that are produced are Web Service compatible interface files and adapters for your session beans, meaning you get one web service for each session. It then creates a Publish file that allows you to easily publish those services to the outside world. Currently we only support the automation of the GLUE web services toolkit,
which uses the SOAP industry standard protocol. In fact the only file
that is GLUE specific is the Publish file. The rest is pure Java. No doubt
it should be easy to support other Web Service toolkits in the future,
however the best of breed at the moment seems to be GLUE. |
|
Class Hierarchy The top-level ServiceWriter class hierarchy is illustrated below: -
|
|
Web Service Properties There's only a few Web Service specific properties: webservice.serverpackage=$PACKAGE.webservice The serverpackage refers to the name of the package where the Web Service files are created. The clientpackage refers to the name of the package where the Web Service files are created. The port property refers to the port that the Web Services will be published on. |
|
Web Service Files The Web Service interface files go into the client package, the rest in the server package. This clear separation makes it easy for clients to just include in the interfaces without polluting their classpath with inappropriate server classes. Once you've run the generator you should see a new server and client package. For example, if I had a Category table, then I'd have CategoryService interface file in the client package, and a CategoryServiceBean inside the server package. You can publish these services with the generated Publish class which you should find in the server package. The template for this file is: com.javelin.generator.webservice.templates/Publish.java It also creates an index.html file in the docbase subdirectory of the webservice package, which lists links to the various services, i.e. acts as a service directory page. The Publish file point the GLUE webroot at that directory, so if someone
points their browser at the glue server with no service name then they
get this e.g. http://www.javelinsoft.com:8081/index.html The template for this file is: com.javelin.generator.webservice.templates/docbase_index.html Just run Package.java and then point your browser at a service. For example for the Category service you might type: http://localhost:8081/glue/urn:CategoryService.wsdl This will show you the wsdl for this service, which any SOAP compliant tool will understand. With GLUE you can also access web services via its GET/POST bindings, e.g. http://localhost:8081/glue/urn:CategoryService/findByPrimaryKey?categoryId=2 You can also publish in other ways, and can integrate the glue server into your own web server, but that's really a matter for GLUE, so if you want to really get into web services then best read the GLUE User Guide
|