aspose file tools*
The moose likes Web Services and the fly likes Why would an wsdl document have a targetnamespace attribute set? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Why would an wsdl document have a targetnamespace attribute set?" Watch "Why would an wsdl document have a targetnamespace attribute set?" New topic
Author

Why would an wsdl document have a targetnamespace attribute set?

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,

I have an xml document, namely a WSDL file and I am trying to understand why the "definitions" element have "targetNamespace" attribute set???

I thought this attribute was only for schemas. Is this not confusing? Is this legal? Why wsdl files don't have a schema to validate themselves from?

Here is my document:



[ May 16, 2006: Message edited by: Julien Martin ]
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
XML namespaces are not a feature XML Schema. They are simply a feature of XML and their use is governed by the Namespaces in XML document (see also Ronald Bourret's XML Namespaces FAQ). Their function is similar to that of packages in Java � insofar as both help avoid naming collisions.

XML Schema is simply an XML application used to define, constrain and validate other XML Applications (XML Markup Languages). There are Schema alternatives like Schematron or RELAX NG. Namespaces can be used in DTDs. In WSDL you can only reference XML Schema though.

WSDL is an XML application that is used to describe web services. XML Schema was designed to define XML elements and attributes and constrain them for other markup langauges. WSDL requires definition of higher level concepts such as method parameters (part), method signatures (message, input, output), methods (operation), port interfaces (portType), and bindings (binding, service, port) for them which are outside of the scope of XML Schema � so it needs to put these definitions somewhere and it puts them into the targetNamespace.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why would an wsdl document have a targetnamespace attribute set?