【问题标题】:XML Namespace error in WSDL fileWSDL 文件中的 XML 命名空间错误
【发布时间】:2011-04-14 15:17:48
【问题描述】:

我有以下服务定义(不完整,但演示了错误。 Visual Studio 在我定义 OffertXML 的行告诉我(从德语翻译)“在此架构命名空间中 http://schemas.xmlsoap.org/wsdl/ 不可用”。

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="TestOffertverwaltung"
 targetNamespace="urn:TestOffertverwaltung"
 xmlns:tns="urn:TestOffertverwaltung"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:types="urn:Test/types"
 xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
 xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
 xmlns="http://schemas.xmlsoap.org/wsdl/">

    <wsdl:types>

        <xsd:schema targetNamespace="urn:Test/types">

            <xsd:element name="OffertXML" type="string"/>
            <xsd:element name="OffertPDF" xmime:expectedContentTypes='image/jpeg' type="xmime:base64Binary"/>
            <xsd:element name="OffertMeta" type="string"/>
            <xsd:element name="OffertId" type="string"/>

        </xsd:schema>

    </wsdl:types>

<!-- ... -->
</wsdl:definitions>

【问题讨论】:

    标签: xml namespaces wsdl xml-namespaces xml-validation


    【解决方案1】:

    你需要设置你的类型

    type="xsd:string"
    

    目前使用的是在默认命名空间http://schemas.xmlsoap.org/wsdl/string中将类型设置为字符串,因此这是一个不可用的类型。

    【讨论】:

    • 为什么不可用?周围的元素在命名空间 xsd 中。
    • 只是因为周围元素位于 xsd 命名空间中,不会更改默认命名空间 (xmlns="...") - 这就是类型将被扩展的对象。
    猜你喜欢
    • 2021-06-27
    • 2017-02-16
    • 2019-10-18
    • 1970-01-01
    • 2015-03-16
    • 2020-01-29
    • 2011-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多