tns appearing in Web Services schema

48,473

As per w3, tns means "this namespace", referring to the current document.

Source: https://www.w3.org/TR/wsdl.html#_notational

Share:
48,473
Vicky
Author by

Vicky

Updated on May 15, 2020

Comments

  • Vicky
    Vicky almost 4 years

    I'm using JAX-WS for running some sample Web services. After publishing the web services, when I typed the WSDL URL, I could see the WSDL document. WSDL document refers a Schema document that goes like this:

    <xs:schema version="1.0" targetNamespace="http://ts.ch01/">
    <xs:element name="getTimeAsElapsed" type="tns:getTimeAsElapsed"/>
    <xs:element name="getTimeAsElapsedResponse" type="tns:getTimeAsElapsedResponse"/>
    <xs:element name="getTimeAsString" type="tns:getTimeAsString"/>
    <xs:element name="getTimeAsStringResponse" type="tns:getTimeAsStringResponse"/>
    −
    <xs:complexType name="getTimeAsString">
    <xs:sequence/>
    </xs:complexType>
    −
    <xs:complexType name="getTimeAsStringResponse">
    −
    <xs:sequence>
    <xs:element name="return" type="xs:string" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    −
    <xs:complexType name="getTimeAsElapsed">
    <xs:sequence/>
    </xs:complexType>
    −
    <xs:complexType name="getTimeAsElapsedResponse">
    −
    <xs:sequence>
    <xs:element name="return" type="xs:long"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    

    My question is why is 'tns' appearing in the element declaration? For example:

    <xs:element name="getTimeAsElapsed" type="tns:getTimeAsElapsed"/>

    I've nowhere is the schema document seeing 'tns' to be declared as namespace prefix, the schema document simply starts with

    <xs:schema version="1.0" targetNamespace="http://ts.ch01/">
    

    Then why 'tns' is appearing when referencing other elements? Is this by default behaviour of XML schema generated by JAX-WS?