use*_*231 5 xml import wsdl ref
我有两个 WSDL 文件。我正在尝试在复杂类型元素中的另一个 WSDL 文件中使用在一种 WSDL 类型中定义的元素。
为此,我使用导入元素包含了另一个 WSDL 文件(otherfile.wsdl 位于同一文件夹中)。此外,我设置了命名空间并使用 ref 属性(加上命名空间)来引用其他 WSDL 文件中的元素。
但是,它抱怨来自 othertest 命名空间的元素无法从此 test.wsdl xml 模式引用。有人知道如何解决这个问题吗?
您将在下面找到这两个文件的代码:
测试.wsdl
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.example.com/test/"
xmlns:ot="http://www.example.com/othertest/"
targetNamespace="http://www.example.com/test/" >
<import namespace="http://www.example.com/othertest/" location="othertest.wsdl"/>
<types>
<xsd:schema targetNamespace="http://www.example.com/test/">
<xsd:element name="ResultElement2">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="ot:othertest_element" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
</definitions>
Run Code Online (Sandbox Code Playgroud)
其他测试.wsdl
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.example.com/othertest/"
targetNamespace="http://www.example.com/othertest/" >
<types>
<xsd:schema targetNamespace="http://www.example.com/othertest/">
<xsd:element name="othertest_element">
<xsd:simpleType>
<xsd:restriction base="xsd:int"/>
</xsd:simpleType>
</xsd:element>
</xsd:schema>
</types>
</definitions>
Run Code Online (Sandbox Code Playgroud)
我有一个部分解决方案。看来,当我在 xsd 文件而不是 WSDL 文件中定义元素/类型并在的元素<xsd:import namespace="..." schemaLocation="..." />中使用导入此文件时,它不会抱怨命名空间。然而,一旦我再次导入 wsdl 文件(其中包含了类型和元素),它就开始再次抱怨命名空间。<xsd:schema><types><types>
但是,问题仍然存在,我提供的是 wsdl 文件,而不是 xsd 文件。有没有办法在<types>另一个 wsdl 文件的部分中重用 wsdl 文件中定义的元素/类型?
| 归档时间: |
|
| 查看次数: |
7878 次 |
| 最近记录: |