Guillaume Camus
Guillaume Camus

Reputation: 163

Spring and Jax-WS : where are xsd schema?

In spring file applicationConfig.xml, JAX-WS integration need some specific schemas. I recently successfully use these declarations :

[I must remove all url (except one) because it's my first question]

The file begins with those declarations :
<beans xmlns="http www.springframework.org/schema/beans" xmlns:xsi="http www.w3.org/2001/XMLSchema-instance" xmlns:aop="http www.springframework.org/schema/aop" xmlns:tx="http www.springframework.org/schema/tx" xmlns:context="http www.springframework.org/schema/context" 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 www.springframework.org/schema/aop http www.springframework.org/schema/aop/spring-aop.xsd http www.springframework.org/schema/tx http www.springframework.org/schema/tx/spring-tx.xsd http www.springframework.org/schema/context http www.springframework.org/schema/context/spring-context.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">
(...)
<ws:service id="myService" bean="#myWS" />
<wss:binding url="/services/myws" service="#myService" />

Now, a migration occurs for website jax-ws.dev.java.net. These files are not found and I have some errors under Tomcat and Eclipse :

org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'https://jax-ws.dev.java.net/spring/core.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .

Is there a solution or something to prevent this error ?

Thanks

Upvotes: 0

Views: 16235

Answers (3)

tanderson
tanderson

Reputation: 36

You don't need to extract the XSD from the jaxws-spring jar. You just need to make sure the URL you use corresponds to that in the META-INF/spring.schemas file in the jar

They are defined as follows:

http\://jax-ws.dev.java.net/spring/core.xsd=spring-jax-ws-core.xsd
http\://jax-ws.dev.java.net/spring/servlet.xsd=spring-jax-ws-servlet.xsd
http\://jax-ws.dev.java.net/spring/local-transport.xsd=spring-jax-ws-local-transport.xsd

Think you just need to replace https with http. E.g:

<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-3.0.xsd
          http://jax-ws.dev.java.net/spring/core http://jax-ws.dev.java.net/spring/core.xsd
          http://jax-ws.dev.java.net/spring/servlet http://jax-ws.dev.java.net/spring/servlet.xsd>

For more info on spring.schemas, see here

Upvotes: 1

Guillaume Camus
Guillaume Camus

Reputation: 163

Finaly I extract XSD from jaxws-spring-1.8.jar (lib for jax-ws to work with Spring). I put these XSD under WEB-INF directory, just near applicationContext.xml. I modify declaration of schema in this file with :

   http://jax-ws.dev.java.net/spring/core classpath:spring-jax-ws-core.xsd
   http://jax-ws.dev.java.net/spring/servlet classpath:spring-jax-ws-servlet.xsd

I have seen the solution here : Spring schemaLocation fails when there is no internet connection

Upvotes: 4

chzbrgla
chzbrgla

Reputation: 5188

I suppose you're using maven for building? Try adding the dependency to the pom.xml

<dependency>
      <groupId>javax.xml.ws</groupId>
      <artifactId>jaxws-api</artifactId>
      <version>2.1-1</version>
</dependency>

If you're not using maven, make sure you have jax-ws libs on your classpath. http://java.net/projects/jax-ws

Upvotes: 1

Related Questions