2017-12-02 208 views
2

我想学习wsdl作为一个新鲜。我没有完全理解XML或任何事情。我只知道基础知识。我看到wsdl中的基本类型通常是xml模式,因此使用xsd:string等。为什么'tns'前缀在wsdl文件的类型元素中不需要?

我的问题是:

在WSDL类型的元素,它里面不使用tns前缀就像是用于操作元素。为什么?

我附上了教程网站的摘录。

<xs:schema 
    xmlns:xs=  "http://www.w3.org/2001/XMLSchema" 
    targetNamespace= "http://jenkov.com/MyService/schema" 
    xmlns:tns=  "http://jenkov.com/MyService/schema"> 

    <xs:element name="latestTutorialRequest" type="typeLatestTutorialRequest"/> 
    <xs:complexType name="typeLatestTutorialRequest"> 
     <xs:sequence> 
     <xs:element name="date" type="xs:date"/> 
     </xs:sequence> 
    </xs:complexType> 
    <xs:element name="latestTutorialResponse" type="xs:string"/> 
    <xs:element name="invalidDateError" type="xs:string"/> 
</xs:schema> 

不是应该..

<xs:schema 
    xmlns:xs=  "http://www.w3.org/2001/XMLSchema" 
    targetNamespace= "http://jenkov.com/MyService/schema" 
    xmlns:tns=  "http://jenkov.com/MyService/schema"> 

    <xs:element name="latestTutorialRequest" type="**tns:typeLatestTutorialRequest**"/> 
    <xs:complexType name="typeLatestTutorialRequest"> 
     <xs:sequence> 
     <xs:element name="date" type="xs:date"/> 
     </xs:sequence> 
    </xs:complexType> 
    <xs:element name="latestTutorialResponse" type="xs:string"/> 
    <xs:element name="invalidDateError" type="xs:string"/> 
</xs:schema> 

回答

0

我同意,因为写的模式是错误的。这就是撒克逊人所说的:

Saxon-EE 9.8.0.6J from Saxonica 
Java version 1.8.0_121 
Using license serial number V005192 
Loading schema document file:/Users/mike/Desktop/temp/test.xsd 
Error at xs:element on line 6 column 80 of test.xsd: 
    Cannot reference schema components in the null namespace as it has not been imported 
Schema processing failed: One error was found while processing the schema 
相关问题