WSDL schemaLocation:是否可以使用相对路径将 .xsd 导入到 .wsdl 中? [英] WSDL schemaLocation : Is it possible to import a .xsd into a .wsdl using a relative path?
问题描述
这是我的 WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://xxx" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns0="http://xxx/commun/axis" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://xxx" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema targetNamespace="http://xxx/commun/axis" xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:include schemaLocation="https://host:port/path/WebServices/wsdl/typesServicesApplicatifs.xsd"/>
(...)
typesServicesApplicatifs.xsd 文件与 WSDL 文件位于同一目录中(在战争中),是否可以使用相对路径而不是架构位置的绝对路径?
The typesServicesApplicatifs.xsd file is in the same directory as the WSDL file (inside a war), is it possible tu use a relative path instead of an absolute path for the schema location ?
这真的很有帮助,因为目前,每个环境的 schemaLocation 都不同(必须指定主机和端口).
It would be really helpful, because for now, the schemaLocation is different on each environnment (the host and the port have to be specified).
EDIT :这个问题与该线程中的最后一个相同(没有答案):http://forum.springsource.org/showthread.php?p=342542
EDIT : this question is the same as the last one in this thread (with no answer) : http://forum.springsource.org/showthread.php?p=342542
推荐答案
这是实现此目的的方法:
Here is a way to achieve this :
使用 Spring-WS,可以从以下位置自动生成 WSDL:
Using Spring-WS, the WSDL can be generated automatically from :
<sws:dynamic-wsdl id="holiday" portTypeName="HumanResource" **locationUri="/holidayService/"** targetNamespace="http://mycompany.com/hr/definitions">
<sws:xsd location="/WEB-INF/hr.xsd"/>
</sws:dynamic-wsdl>
来源:http://static.springsource.org/spring-ws/site/reference/html/tutorial.html#tutorial-publishing-wsdl
这样,主机、端口和上下文路径不需要在 WSDL 中指定.
This way, the host, port and context path don't need to be specified inside the WSDL.
这篇关于WSDL schemaLocation:是否可以使用相对路径将 .xsd 导入到 .wsdl 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!