开发者

Axis2 POJO Web Services

I have a POJO which is being deployed as a webservice in Axis2 - Tomcat combo. What is the best way to supply runtime configurations to the service? All servcie related config parameters are in XML file -

  1. What's the best location to keep this config file? Note I want the service to be completely self contained.

  2. How do I get the physical location of the service home i.e. Tomcat 6.0\webapps\axis2\WEB-INF\services\MyService?

  3. How good is Axis2 i.e. is it a good choice to select Axis2 as webservice platform? The project is with aggressive timelines (what's new? :)) so really do not wish to dive into the Contract First etc stuff. Need a quick solution where I can drop in POJO and use it as webservice.

    开发者_如何转开发

As always, Your help is very much appreciated!


I used JNDI to control the runtime configuration options for simple web services. How to configure JNDI depends on the container you are using, Jetty/Tomcat etc.

More complicated projects I embed spring and manage both configuration and other persistent objects.

Axis2 is a good platform for developing stand-alone web services. I'd still recommend having a look at contract first stuff. It is of course more complicated but gives more control over the XML messages exchanged between client and server. The neat thing about Axis2 is that you can start with POJOs and get more complicated later.


Note I want the service to be completely self contained.
Do u mean u would like to move this modules on other container ... which do not support TOMCAT based dir structure...... bit difficult

If Axis hosting concern is of TOMCAT alone then the best way to use the configurations is via an Property /XML file stored at the root of the Java package and haven a Startup servlet with load on startup 1 to read the property file using

context.getRealPath("") + "/WEB-INF/classes/abcd.xml" or context.getRealPath("") + "/WEB-INF/classes/abcd.propertyfile

Store the same in a key /value based Hashtable ...further store the Hash table in Servletcontext.

On any where required fetch the Valu by passing the Key to the Hash table and use the same.

However the startup servlet should run Once only only by using Load on startup tag in web-xml ...

hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜