Saturday, June 26, 2010

WebServices with CXF - Configuration files III

Now I'll cover my Apache CXF configuration file

As I said before this is not rocket science. It follows the same logic used in every Spring configuration file, everything is based on Beans tags

If you remember my serviceApplicationContext, I declared a Bean called LibraryService

Well, we're going to make reference to this particular Bean on our CXF configuration file, so we can expose it (We already changed our Interface & Implementation using annotations)

Now if you analyze carefully my CXF configuration file, this section links my Spring Bean (Service) with my endpoint on CXF through implementor & implementorClass attributes, which basically link my Java Code (implementorClass) and my Spring Bean (implementor);
The only thing you must add is "#" character before Spring's Bean name: #LibraryService

Finally, I'm using another attribute called address to declare the address for this WebService, by declaring it as address="/LibraryService", this will be my URI for this WebService: http://localhost:8080/little-library-lite/services/LibraryService


Why /services/LibraryService?? I declared on my web.xml that URL Pattern.

In my next and last entry I'll test this WebService using JUnit, if you want to see the WSDL file for all your available WebServices, you can do it by going to http://localhost:8080/little-library-lite/services

There you'll see a list of available WebServices and by clicking them you'll see each one's WSDL

No comments:

Post a Comment