*
The moose likes Web Services and the fly likes Target namespace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Target namespace" Watch "Target namespace" New topic
Author

Target namespace

Sam Ruben
Greenhorn

Joined: Feb 07, 2012
Posts: 9
whats the purpose using target namespace in a wsdl?
Roger Sterling
Ranch Hand

Joined: Apr 06, 2012
Posts: 426

A target namespace qualifies the children attributes so that you can refer to multiple children that have the same name but different contexts. For example, a child named 'ZipCode' in the 'com.yourcompany.inquiry' namespace might only need a single numeric five digit integer whereas a child named 'ZipCode' in 'gov.usps.www' namespace might need a character string of ten characters in length (zip+four).
Sam Ruben
Greenhorn

Joined: Feb 07, 2012
Posts: 9
Hi Thank you. I just have a doubt. namespace is generally used to avoid conflicts in naming XML tags.

eg:

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

why does the targetNamespace is used here? what the value http://www.w3schools.com is referred to?

xmlns:xs="http://www.w3.org/2001/XMLSchema -- I have understood this point.
Anurag Verma
Ranch Hand

Joined: Mar 30, 2012
Posts: 124

targetNamespace is similar as giving package name in java & namespaces in C++. By targetNamespace we specify that the xml is inside the mentioned namespace.
Did that answer or you needed something else?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Target namespace