有没有一种方法可以将WSDL的架构元素包含到单独的XSD中?

问题描述

假设我有WSDL:

<?xml version="1.0"?>
<deFinitions name="StockQuote"
             targetNamespace="http://example.com/stockquote.wsdl"
             xmlns:tns="http://example.com/stockquote.wsdl"
             xmlns:xsd1="http://example.com/stockquote.xsd"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns="http://schemas.xmlsoap.org/wsdl/">

  <types>
    <schema targetNamespace="http://example.com/stockquote"
            xmlns="http://www.w3.org/2000/10/XMLSchema">
      <element name="TradePriceRequest">
        <complexType>
          <all>
            <element name="tickerSymbol" type="string"/>
          </all>
        </complexType>
      </element>
      <element name="TradePrice">
         <complexType>
           <all>
             <element name="price" type="float"/>
           </all>
         </complexType>
      </element>
    </schema>
  </types>
...
</deFinitions>

而且我需要其架构进行验证,因此它需要在XSD中。 我无法修改合同(WSDL),所以我只是将粘贴的架构复制到另一个XSD,这使我每次客户端修改合同时都复制粘贴的架构。为了使其完全相同,我认为将其包含在这样的单独的XSD文件中会很好:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.com/stockquote">
  <xs:include schemaLocation="stockquote.wsdl"/>
</xs:schema>

我需要此XSD来运行验证,所以无论如何都是WSDL + XSD。

那么有没有办法进行这样的包含?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)