-
29-09-2019 - |
题
我需要创建一个带有弹簧3.0.4.的WS的WS。我正在关注此文档: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html#remoting-web-services-services-services-jaxws-jaxws-export-port-port-ri (如果该段可以称为“ DOC”)
好的,以下是细节:
Java类:
package foo;
@WebService(serviceName="MyService")
public class MyService{
@WebMethod
public String getString(){
return "Hello StackOverflow";
}
}
Web-Inf/spring-ws.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://jax-ws.dev.java.net/spring/core https://jax-ws.dev.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet https://jax-ws.dev.java.net/spring/servlet.xsd">
<wss:binding url="/myService" service="#myService" />
<ws:service id="myService"
impl="foo.MyService" />
</beans>
Web-Inf/web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="myService" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>my Service</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-ws.xml</param-value>
</context-param>
<!-- this is for Spring -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- these are for JAX-WS -->
<servlet>
<servlet-name>jaxws-servlet</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>jaxws-servlet</servlet-name>
<url-pattern>/myService</url-pattern>
</servlet-mapping>
最后,但同样重要的是 错误 当我 启动Tomcat 6.0.29:
Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://jax-ws.dev.java.net/spring/servlet]
Offending resource: ServletContext resource [/WEB-INF/spring-ws.xml]
有人对正在发生的事情有任何线索吗?所有配置都正确吗?是否有人有一个简单的(工作)WS来展示如何使用Spring部署WS?
提前致谢
解决方案
我还没有一段时间经历了这个问题,并弄清楚问题是“ https://”。将其更改回http://,您应该很好。但是,当您使用http://时,您会在Eclipse中获得架构验证错误,因为Eclipse无法自动从http://将架构URL自动重定向到https://。显然,Netbeans能够做到这一点。
还有一件事。您也必须拥有Xbeans-Spring。老实说,我认为这是一个非常愚蠢的依赖。
不隶属于 StackOverflow