我在我的spring项目中使用JAXWS与服务器通信,并且在我的应用程序上下文xml中有一个XSD读取错误。这是应用程序上下文 -
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:ws="http://jax-ws.java.net/spring/core"
xmlns:wss="http://jax-ws.java.net/spring/servlet"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
//**error at this below line -** **cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'wss:binding'.**
<wss:binding url="/hello">
<wss:service>
<ws:service bean="#helloWs"/>
</wss:service>
</wss:binding>
<!-- Web service methods -->
<bean id="helloWs" class="com.mkyong.ws.HelloWorldWS">
<property name="helloWorldBo" ref="HelloWorldBo" />
</bean>
<bean id="HelloWorldBo" class="com.mkyong.bo.impl.HelloWorldBoImpl" />
任何人都可以让我知道这个错误和任何解决方案可能是什么原因。 谢谢你的帮助。!
答案 0 :(得分:3)
为什么不尝试以下xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://jax-ws.dev.java.net/spring/core http://jax-ws.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet http://jax-ws.java.net/spring/servlet.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<wss:binding url="/hello">
<wss:service>
<ws:service bean="#helloWs"/>
</wss:service>
</wss:binding>
<!-- Web service methods -->
<bean id="helloWs" class="com.mkyong.ws.HelloWorldWS">
<property name="helloWorldBo" ref="HelloWorldBo" />
</bean>
<bean id="HelloWorldBo" class="com.mkyong.bo.impl.HelloWorldBoImpl" /> </beans>
答案 1 :(得分:3)
你在项目中使用spring吗?我有同样的问题,但是当我在我的maven依赖项中包含spring-jaxws问题解决了,实际上,你可以在那个jar中看到META-INF / spring。模式文件正在重新定义XSD位置:
HTTP \://jax-ws.java.net/spring/core.xsd=spring-jax-ws-core.xsd HTTP \://jax-ws.java.net/spring/servlet.xsd=spring-jax-ws-servlet.xsd HTTP \://jax-ws.java.net/spring/local-transport.xsd=spring-jax-ws-local-transport.xsd
我希望它有所帮助!