【问题标题】:WSDL schemaLocation : Is it possible to import a .xsd into a .wsdl using a relative path?WSDL schemaLocation:是否可以使用相对路径将 .xsd 导入 .wsdl?
【发布时间】:2011-04-21 16:47:34
【问题描述】:

这是我的 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 文件位于同一目录中(在战争中),是否可以使用相对路径而不是架构位置的绝对路径?

这真的很有帮助,因为目前,每个环境中的 schemaLocation 都不同(必须指定主机和端口)。

编辑:这个问题与这个线程中的最后一个问题相同(没有答案):http://forum.springsource.org/showthread.php?p=342542

【问题讨论】:

    标签: xml web-services xsd wsdl


    【解决方案1】:

    这是实现此目的的一种方法:

    使用 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 中指定主机、端口和上下文路径。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-20
      • 2012-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多