Copyright  2001-2007 Nicholas Quaine.
Home   Basics   ServerSide   ClientSide   Demos   FAQ   Resources
Home
Welcome
About this site
About the authors
Contacting us
Sitemap
Partner Sites
XMethods
Top XML SOAP Zone

Article
Generating a Deployment Descriptor from your Service Classes

In a previous article, we saw how to create run-time interfaces based on the parsing of a deployment descriptor. Here, we will see how we can generate a deployment descriptor from a Service Interface and Implementation.

This utility takes

and produces a well-formed DeploymentDescriptor, GeneratedDD.xml

The source code for this utility is in DDGenerator.java

Explanations

This utility uses introspection to find out the methods for which to generate mappings, and recursion to generate Type Mappings for all beans that are linked to the service implementation. Naturally, all primitive types and all "java.lang" types do not generate Type Mappings.

The extracted info from the classes will map to the following template fields in the deployment descriptor template:

  • %serviceName%
  • %spaceDelimitedMethodNameList%
  • %fullyQualifiedImplementationClassName%

The info found for each bean will map to the following template fields in the mapping entry template:

  • %serviceName%
  • %fullyQualifiedBeanClassName%

The code simply replaces the template fields above with their real values. Care is taken not to generate the same bean mapping twice.

Conclusion

When you already have a set of services to export as SOAP services, you can use this utility to quickly generate a standard deployment descriptor for your services. Again, this reduces mistakes due to the strong coupling that exists between the Java code and the deployment descriptor.


(1) This file is really a portion of XML. It has been renamed with a "txt" extension to be visible in a browser, otherwise, with its xml extension, it is not a valid xml file and fails to show in a browser!

[ Nicolas Gouteux ]

Copyright 2001-2007 Nicholas Quaine. All rights reserved.