我在 spring 4应用程序中添加了一个简单的jaxws配置文件: beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaL
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <jaxws:client name="https://testecommerce.credibanco.com/vpos2/services/VPOSWS20SOAP/authorize" createdFromAPI="true"> <!-- Uncomment if using WS-SecPolicy method --> <jaxws:properties> <entry key="ws-security.username" value="myuser"/> <entry key="ws-security.callback-handler" value-ref="mypassword"/> </jaxws:properties> </jaxws:client> <bean id="myPasswordCallback" class="com..core.ws.security.PWHandler"/> </beans>
我收到这个错误:
Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws]
我能找到的所有信息都说包括我已经完成的依赖:
<dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxrs</artifactId> <version>3.1.4</version> </dependency>
我也包括这些cxf罐子:
<dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http-hc</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-bindings-soap</artifactId> <version>${cxf.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-ws-security</artifactId> <version>${cxf.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.wss4j</groupId> <artifactId>wss4j-ws-security-common</artifactId> <version>2.1.5</version> </dependency>
我正在使用jboss EAP 7.我也尝试在JBoss EAP 6.4中运行该应用程序并遇到了同样的问题.我也尝试在jboss-deployment-structure中排除Web服务模块,但这会导致其他错误.
您正在使用jax-ws并为jax-rs添加依赖项. WS用于SOAP,RS用于RESTful.添加如下内容:
<dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>2.7.7</version> </dependency>
希望这可以帮助.