是否可以使用多个 cxf.xml 文件来配置系统的不同部分?
看起来很有趣,以前没有人问过这个问题。我有一些关于 CXF 客户端配置的“基本”问题。
我们有一个 Tomcat 运行我们的应用程序。该应用程序需要与 WebService 进行通信。客户端的实现是通过 CXF 完成的,并且该实现被打包在 JAR 文件中。让我们说“ws-client.jar”。对于其他 Web 服务,也有使用 CXF 的其他客户端实现是可能且可取的。每个 WS-Client 都应该打包在自己的 JAR 文件中。所以最后我将拥有我们的应用程序 WAR,其中包含我需要的所有其他 ws-client*.jar。
bigApplication.war:
WEB-INF/lib/ws-client.jar
WEB-INF/lib/ws-client2.jar
WEB-INF/lib/ws-client3.jar
...
WEB-INF/classes/**/*.class
现在的问题是:我可以/可以将 cxf.xml 放在哪里吗?我可以在每个 ws-*.jar 中放置一个配置文件吗?可以在war文件中添加另一个吗?或者只有一个 cxf.xml
文件必须存在?存档中的哪个路径最好?
现在,我只是将配置文件复制到 tomcat/webapps/bigApplication/WEB-INF/classes/cxf.xml 中(可能也不是最好的位置)。问题是,每次部署应用程序时我都需要这样做。我实际上只想配置 ws-client.jar,而不是所有 CXF-WS-Client。所以我想在写入的地方配置尽可能具体的东西。
欢迎任何答案,也链接到正确的信息,但我没有找到。
[更新] 由于这是一个有点长的问题,因此将帖子中的问题放在一起:
- 我可以将 cxf.xml 文件放入 jar 存档中吗?
- 每个应用程序是否可以存在多个 cxf.xml 文件?每个相关的 .jar 文件中都有一个?
- jar 文件中放置 cxf.xml 的最佳路径在哪里?
[/更新]
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]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,应用程序的每个“部分”都有自己的 xml 文件(可能不称为 cxf.xml)。类似于“cxf-client2.xml”或类似的内容。然后会有一个用于战争的“主”cxf.xml,它将导入各种其他 xml 文件。
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.