Pregunta

Es necesario crear un WS con Spring 3.0.4.RELEASE para funcionar en un Tomcat con Axis2. Estoy siguiendo este documento: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html#remoting-web-services-jaxws-export- ri (si es que el párrafo puede ser llamado "doc")

Ok, aquí están los detalles:

La clase Java:

package foo;
@WebService(serviceName="MyService")
public class MyService{
  @WebMethod  
  public String getString(){
    return "Hello StackOverflow";
  }  
}  

La WEB-INF / primavera-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>

La 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>

Y por último, pero no menos importante, la error cuando Para iniciar 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]  

Alguien tiene alguna idea de lo que está sucediendo? Es toda la configuración correcta? ¿Alguien tiene un simple (de trabajo) WS para mostrar cómo implementar un WS utilizando Spring?

Gracias de antemano

¿Fue útil?

Solución

También experimenta este problema hace un tiempo y descubierto el problema es con el "https: //". Cambiarlo de nuevo a http: // y usted debe ser bueno para ir. Pero cuando se utiliza http: // obtiene un error de validación de esquema en Eclipse Eclipse porque no puede esquema automáticamente redirección URL de http: // a https: //. Y al parecer NetBeans es capaz de ello.

Una cosa más. Usted tiene que tener la xbeans-primavera también. Sinceramente, creo que es una dependencia bastante estúpido.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top