开发者

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 :

    • https://jax-ws.dev.java.net/spring/core.xsd
    • https jax-ws.dev.java.net/spring/servlet.xsd

    [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.springframew开发者_如何学运维ork.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


    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


    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


    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

    0

    上一篇:

    下一篇:

    精彩评论

    暂无评论...
    验证码 换一张
    取 消

    最新问答

    问答排行榜