Search code examples
javaconfigurationcxfarchivewar

Is it possible to have multiple cxf.xml files to configure separate parts of the system?


It seems interesting, that nobody asked this before. I have some "basic"-questions about the configuration of CXF Clients.

We have a Tomcat running our application. This application needs to communicate with a WebService. The implementation of the client is done with CXF, and this implementation is packaged in a JAR-File. Lets say "ws-client.jar". It is possible and desirable, that there are other implementations of clients for other webservices, also using CXF. And each WS-Client should be packaged in its own JAR-File. So at the end I'll have our application WAR, containing all other ws-client*.jar I need.

bigApplication.war:
  WEB-INF/lib/ws-client.jar
  WEB-INF/lib/ws-client2.jar
  WEB-INF/lib/ws-client3.jar
  ...
  WEB-INF/classes/**/*.class

And now the question: Where can/may I put the cxf.xml? Can I put a configuration file in each ws-*.jar? Can a put in addition another in the war file? Or only one cxf.xml file must exist? Which path in the archive is the best?

By now I just copy a configuration file in tomcat/webapps/bigApplication/WEB-INF/classes/cxf.xml (probably also not the best place for it). The problem is, I need to do that every time I deploy the application. And I want actually only to configure ws-client.jar, and not all CXF-WS-Clients. So I want to configure things as specific as possible, and in the write place.

Any answer is welcome, also Links to the right information, which I didn't find.

[UPDATE] As it is a somehow long question, here the questions in the post together:

  • Can I put a cxf.xml file in a jar-archive?
  • Can more than one cxf.xml file exists per application? One in each relevant .jar file?
  • Where is the best path in a jar-file to put the cxf.xml?

[/UPDATE]


Solution

  • Normally, each "part" of the application would have it's own xml files (likely not called cxf.xml). Something like "cxf-client2.xml" or similar. There would then be a "main" cxf.xml for the war that would import the various other xml files.