Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tns appearing in Web Services schema

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?

like image 924
Vicky Avatar asked Jun 06 '11 16:06

Vicky


People also ask

What is TNS in Web service?

As per w3, tns means "this namespace", referring to the current document. Not "tns" nor "this namespace" appears anyhere in the linked document. @rkedge yes, it does : "The “this namespace” (tns) prefix is used as a convention to refer to the current document."

What is TNS in WSDL file?

tns stands for tns Namespace (short for Target Name Space) and if you will check any enterprise wsdl it is defined in the beginning <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:enterprise.soap.sforce. ...

What is Web Services schema?

An XML schema describes the structure of an XML document. A valid XML document must be formed and must be validated. A schema defines data types, which can be either simple or complex.

What is targetNamespace in Web service?

targetNamespace is the logical namespace for information about this service. WSDL documents can import other WSDL documents, and setting targetNamespace to a unique value ensures that the namespaces do not clash. xmlns is the default namespace of the WSDL document, and it is set to http://schemas.xmlsoap.org/wsdl/ .


1 Answers

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

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

like image 177
Scott Brickey Avatar answered Sep 28 '22 11:09

Scott Brickey