0

我在我的 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" />

任何人都可以让我知道这个错误的原因和任何解决方案。谢谢你的帮助。!

4

2 回答 2

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>
于 2013-04-15T05:24:33.530 回答
2

你在你的项目中使用 spring 吗?,我有同样的问题,但是当我在我的 maven 依赖项中包含 spring-jaxws 时,问题解决了,事实上,你可以在那个 jar 中看到 META-INF/spring.schemas 文件是重新定义 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

我希望它有帮助!

于 2014-02-08T14:09:36.283 回答