This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.
Axis 2 generates stubs given a WSDL. So you call web services in java just as normal methods. This is nice in theory, but in practice is hard to manage the artifacts generated.
So I switched to Spring WS. Much better.
My feeling is that Axis2 handles attachments and SOAP headers better as you have easier access to the message context. In Spring you need to either implement MessageEndpoint (which doesn't give you the niceties of the inbuilt payload endpoints such as marshalling, JDOM etc) or add Interceptors and inject it into your Endpoint. I find this is adding a level of complexity that I don't need or want. Axis2 has a MessageContext.getCurrentMessageContext(); method that you can call within your implementation service class which is nicer.
However, for simple payload (SOAP body) services I think Spring is cleaner. Simply create a servlet entry in your web.xml, add a spring ws XML config file with some mappings to endpoint classes and you're done.
Note also the Spring forums are a great help. Maybe I'm getting lost on the internet but I can't find a single point to access help on Axis2 like I can by visiting these forums. For example, did you find a place to post this question on any Axis2 forum?
Sorry if this question sounds dumb cos Im new to Spring as well as Web Services. Does that mean creating a web service using Spring WS is different from creating a Spring bean and exposing that as Web Service using Axis 2??
It is actually depends on your requirements Spring –WS supports for contact first but Axis2 supports for both contact –first and code –first approaches. Spring –WS basically concern about XML messaging not much deal with WSDL. With Spring-WS you can expose your services very easily. If you want to expose WSDLs, you just want to write XSD for the messages.
Spring –WS supports many WS* specification but still does not supports for some spec like WS- ReliableMessaging , but axis2 supports most of the WS* specs. Like spring forum there is a good mailing list for Axis2 where you can post your problems and with both Axis2 and Spring-WS you can expose your Spring beans as web services.
I would recommed to use Apache CXF 2.1.x over Spring web services or Axis2. It's built on spring, integrates with spring easily (dependency injection into web service bean, security of web services with spring security with JSR250 annotations - not provided by all JAX-WS implementors since its not part of spec). It also supports JAX-RS (Restful web services).