File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 2906
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.


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why would an wsdl document have a targetnamespace attribute set?
 
Similar Threads
Problem with arrays of primitive types
Create WEbService from WSDL ? Is it possible JAX-WS
BP Analyzer
Proper way to define a fault in a WSDL
Why would an XML document have a targetnamespace attribute set?