| Author |
Using import in wsdl
|
sid sree
Ranch Hand
Joined: Jun 28, 2007
Posts: 186
|
|
Hello,
I am a little confused about why the author has choosen to use import in this particular scenario ??
In the above please look at
Assume the targetnamespace for orders.xsd is http://www.example.com/oms
and
the targetnamespace for faults.xsd is http://www.example.com/faults
Then in this specific case include would work just like import , Is my assumption correct ?
Thanks
Sudarshan
|
 |
Ivan Krizsan
Bartender
Joined: Oct 04, 2006
Posts: 2193
|
|
Hi!
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.
Best wishes!
|
 |
sid sree
Ranch Hand
Joined: Jun 28, 2007
Posts: 186
|
|
The reply has gotten me to ask a few more questions and and also highlight what i actually was trying to ask
I am a little confused about why the author has choosen to use import rather than include in this particular scenario ??
Is it because orders.xsd and faults.xsd have a different name space than ??
If Yes then should not
be included in
I think specifically is incorrect it should rather be
I am picking up these examples from
SOA Using Java Web Services
.
A part of my confusion arises from the earlier example which uses include in a similar situation.
Do you think i should be posting that example too.
And to sum up my confusion
1) In this particular scenario can we use include instead of import.
2) If using import is correct then is incorrect it should rather be ??
Thanks.
|
 |
Adam Smolnik
Ranch Hand
Joined: Apr 15, 2009
Posts: 63
|
|
I have sent link to this thread to Author of "SOA Using JavaTM Web Services"
Adam
|
SCJP, SCWCD, SCBCD, SCDJWS
|
 |
sid sree
Ranch Hand
Joined: Jun 28, 2007
Posts: 186
|
|
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 !
|
 |
Ivan Krizsan
Bartender
Joined: Oct 04, 2006
Posts: 2193
|
|
Hi!
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.
Best wishes!
|
 |
sid sree
Ranch Hand
Joined: Jun 28, 2007
Posts: 186
|
|
Hi, I have a few more questions based on the reply
1) With out including http://www.example.com/getord in the namespace declaration would it be possible to use any of the types defined in orders.xsd ? My bet is No because when imported orders.xsd is imported under the namespace http://www.example.com/oms/getorders
2) Later in the wsdl we can see
This is incorrect according to me as the targetnamespace in the wsdl:types is http://www.example.com/getord (Please refer to the first post where i have posted a snippet of the wsdl)
Please confirm ?
3) If we change the to and
to
(Assuming the getord is used throughout the wsdl to refer to elements from orders.xsd).
It will make a more correct wsdl.
Please confirm ?
Thanks
>
|
 |
 |
|
|
subject: Using import in wsdl
|
|
|