This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Using eclipse (ganymede and web tools) I have a simple pojo service. When I generate the client in eclipse, I get files like servicenameCallbackHandler and servicenamestub. That's using axis2, if my settings are correct.
If I use wsimport I get a client with an object factory and serviceporttype/service and response.
The axis2 samples also use clients that have the object factory type client.
Q. Am I using axis2 incorrectly in eclipse?
Q. Is the service.xml wrong and that the problem?
Q. shoudl axis 2 jax-ws output outputfactory clients?
Please check your private messages regarding an important administrative matter.
Joined: Aug 19, 2005
wsimport is a command line tool for the JAX-WS reference implementation that ships with the JDK 6. The JAX-WS RI uses JAXB for data-binding.
Axis2 merely implements the JAX-WS API to some extent, so the Java artifacts generated can be quite different compared to those generated by the JAX-WS RI. Also Axis2 doesn't use JAXB but instead offers the choice of ADB (default), Apache XmlBeans, or JiBX for data-binding.
Both JAXB and XmlBeans generate "ObjectFactory" classes.
Your Eclipse/WTP environment is probably generating Axis2/ADB code, the Axis2 samples refer to Axis2/XmlBeans examples and wsimport is using the JAX-WS/JAXB RI from the JDK 6.
Joined: Nov 02, 2006
Thanks for that. It's 100% useful. I'll dig more into those.
If you want to write once and be able to port between tomcat and websphere, would one implementation be better over another?
Joined: Aug 19, 2005
Older versions of WebSphere use JAX-RPC web services. More recent versions are JAX-WS based.
The JAX-WS RI requires a minimum of JDK 5 Update 2 and Servlet 2.4. Axis2 (without annotation support) can run on JDK 1.4.
In the end I'm not even sure that "write once and deploy to tomcat and websphere" is a realistic objective. Theoretically once you have successfully deployed the framework to your servlet container(s) you should be able to deploy the web services as WARs or AARs - however I would test that in the real environments before relying on it. Note however that pre-Servlet 2.5 based web services are not ideal if you need to support comet web applications which use long-standing HTTP requests. For that application area NIO-based servers like Grizzly or Apache MINA are better suited.