This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The author of the WSDL you showed has probably chosen to separate the definitions of data structures related to orders and faults due to one or more of the following reasons:
He/she wants to be able to reuse the datastructures somewhere else without retaining multiple copies of the definitions.
He/she wants to keep the WSDL more "clean", perhaps also shorter.
Importing an XML schema and including an XML schema differs according to the following:
Import a XML schema that has a different namespace from the XML schema into which it is imported.
Include a XML schema that has the same namespace that the XML schema into which it is included.
The target namespace of a WSDL is not necessarily the same as the target namespace in which an XML schema is imported, and so the <import> element needs to be used. Also the WS-I Basic Profile 1.1, entry R2002, specifies that the XML schema <import> element must be used.
Hey thanks .... but i hope he does'nt get pissed off because i said that the book is wrong .... it was more of a polite inquiry !
Joined: Oct 04, 2006
Yes, <import> is used for two reasons.
1. As you note, the target namespace of the WSDL document is different from that of the <imported> schemas. Thus <import> must be used.
2. To conform with the Basic Profile in order to improve interoperability, <import> must be used.
I wouldn't say that the namespace declaration you mention is wrong, since it seems to be the target namespace of the WSDL, but it seems like there is a namespace declaration missing for the URI http://www.example.com/getord.