Java 野蝇上的骆驼
我已经创建了一个SOAP Web服务,我想在wildfly上用camel cxf公开它 当我想要部署它时,我得到以下错误: 在ws-endpoint部署中检测到Apache CXF库(CXF-core-3.2.0.jar);提供适当的部署,用容器模块依赖项替换嵌入式库,或者为当前部署禁用webservices子系统,并向其添加适当的jboss-deployment-structure.xml描述符。建议使用前一种方法,因为后一种方法会导致大多数Web服务JavaEE和任何特定于JBossWS的功能被禁用 尝试了建议,但没有成功。试图从my pom.xml中包含的caml cxf中排除cxf依赖项:Java 野蝇上的骆驼,java,apache-camel,cxf,wildfly,Java,Apache Camel,Cxf,Wildfly,我已经创建了一个SOAP Web服务,我想在wildfly上用camel cxf公开它 当我想要部署它时,我得到以下错误: 在ws-endpoint部署中检测到Apache CXF库(CXF-core-3.2.0.jar);提供适当的部署,用容器模块依赖项替换嵌入式库,或者为当前部署禁用webservices子系统,并向其添加适当的jboss-deployment-structure.xml描述符。建议使用前一种方法,因为后一种方法会导致大多数Web服务JavaEE和任何特定于JBossWS的功
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.20.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.20.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.20.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
您能否帮助我解决这些错误,或者提供一个可以在wildfly上部署和扩展的小型工作示例?非常感谢
在my pom.xml中定义了以下依赖项:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.20.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.20.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.20.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
org.apache.camel
驼芯
2.20.0
org.apache.camel
骆驼型cxf
2.20.0
org.apache.cxf
*
org.springframework
弹簧网
5.0.1.发布
org.springframework
spring上下文
5.0.1.发布
爪哇
javaeewebapi
8
假如
下面是我的camel.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<cxf:cxfEndpoint id="customerEndpoint"
address="http://localhost:8080/TestService/"
serviceClass="my.package.TestService"
wsdlURL="WEB-INF/CustomerService.wsdl"/>
<bean id="logBean" class="my.package.LogBean"/>
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxf:bean:customerEndpoint" />
<to uri="bean:logBean" />
</route>
</camel:camelContext>
跟进问题
我可以用@Tadayoshi Sato提供的链接建立一个Web服务。然而,这些示例仅使用一个简单函数和一个处理器。在端口定义中有多个操作时,如何知道调用了哪个函数?
是否可以让camel调用所调用的所提供接口的实现,或者我必须自己映射该接口?正如Claus指出的,最推荐的在WildFly上使用camel的方法是使用WildFly camel。您可以在下面的链接中找到如何将WildFly Camel子系统安装到WildFly:
一旦您安装了WildFly Camel,让我们看看这个链接,在这里您可以找到如何在WildFly上使用Camel cxf开发代码:
关键是WildFly已经有了自己的CXF库作为子系统,您需要尽可能多地使用内置库;否则,您可能会遇到类似问题中的尴尬问题。正是WildFly Camel子系统让您可以将底层WildFly子系统用于Camel应用程序 更新: 对于camel cxf使用者,调用的操作名称可通过
CxfConstants.operation\u name
消息头获得。根据:camel cxf endpoint consumer POJO数据格式基于,因此消息头的属性名为
CxfConstants.OPERATION\u name
,消息体是SEI方法参数的列表
您可以相应地选择和更改实现。您可能希望了解wildfly camel,它旨在作为子模块在wildfly/JBoss EAP上运行camel。非常感谢。这帮助我使用camel cxf运行Web服务。你也碰巧知道我后续问题的答案吗?谢谢。它似乎有效=)因为我试图使用XML来定义骆驼路线,所以我不得不使用
${header.soapAction | operationName}
。我认为,在Java代码中使用它时,您需要导入camel cxf传输(至少我是从中推断出来的。另外,有趣的是,在使用多个参数时,您可能希望像这样调用bean: