WSDL schemaLocation:是否可以使用相对路径将.xsd导入到.wsdl中?
问题描述:
这里是我的WSDL:WSDL schemaLocation:是否可以使用相对路径将.xsd导入到.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文件(战争中),是有可能TU使用相对路径,而不是绝对路径为模式位置 ?
这将是非常有用的,因为现在,schemaLocation在每个环境(主机和端口都必须指定)上是不同的。
编辑:这个问题是一样的,在这个线程的最后一个(无答案):http://forum.springsource.org/showthread.php?p=342542
答
这是一种方式来实现这一目标:
使用Spring-WS的WSDL
<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内部指定。