假设我有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。
那么有没有办法进行这样的包含?