【问题标题】:jax-ws how to include xml schema in wsdl instead of xsd import?jax-ws 如何在 wsdl 中包含 xml 架构而不是 xsd 导入?
【发布时间】:2014-04-22 21:34:53
【问题描述】:
我注意到我的 wsdl 有一个 xsd:import 可以从 url 导入 xml 架构。我必须做什么才能在 wsdl 本身中显示 xml 架构?我预计将使用我的 Web 服务的另一个团队将需要它。我不知道他们为什么需要它,但如果他们要求,我想知道该怎么做。
<xsd:schema>
<xsd:import schemaLocation="http://localhost:8081/MySoapFaultExample/myservice?xsd=1" namespace="http://ws.companyname.com/"/>
</xsd:schema>
【问题讨论】:
标签:
xml
wsdl
schema
jax-ws
【解决方案1】:
只需放置整个 xml 架构而不是 <xsd:import> 元素。一个简单的例子,看看它会是什么样子:
<xsd:schema>
<xsd:element name="GetProductInfo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="productName" type="string"/>
<xsd:element name="productCode" type="integer"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
您可以在 W3Schools 中找到 WSDL 基础知识,并在 here 中找到一些 WSDL 示例。