【发布时间】:2015-02-26 19:34:43
【问题描述】:
我有一个 Spring SOAP Web 服务,它托管一个导入多个 XSD 文件的 WSDL。 WEB-INF文件夹里面的结构是这样的:
WEB-INF
│ spring-ws-servlet.xml
│ web.xml
│
└───Esquemas
│ composite.xml
│ Esquemas.jpr
│ EsquemasApplication.jws
│ SIAS.wsdl
│
├───src
│ └───META-INF
│ jps-config.xml
│
├───xsd
│ │ hello.html
│ │ readme.txt
│ │ SIAS.xsd
│ │
│ ├───common
│ │ CommonInterchange.xsd
│ │ CommonTypes.xsd
│ │ IdentifyReply.xsd
│ │ readme.txt
│ │
│ └───interchange
│ CAEFF.xsd
│ CSEFF.xsd
│ readme.txt
│
└───xsl
我正在使用 IntelliJ Idea Ultimate 运行该项目。项目运行正常,通过
可以看到wsdlhttp://localhost:8080/sias.wsdl
但是当我尝试在 SoapUI 中生成 Web 服务测试时,我收到以下错误:
Error loading [http://localhost:8080/xsd/interchange/CAEFF.xsd]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error:
事实上,当我在浏览器中尝试该 URL 时,我得到一个 404 错误代码。
我怎样才能使 /WEB-INF/Esquemas/xsd/ 下的文件夹 xsd 准确可用通过 GET?
这是我的 web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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"
version="2.4">
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>spring-ws</servlet-name>
<url-pattern>*.wsdl</url-pattern>
</servlet-mapping>
</web-app>
这是我的 spring-ws-servlet.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:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<context:component-scan base-package="com.app.sample"/>
<sws:annotation-driven/>
<sws:static-wsdl id="sias"
location="/WEB-INF/Esquemas/SIAS.wsdl"/>
</beans>
【问题讨论】:
标签: spring web-services soap xsd wsdl