• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Using import in wsdl

 
Ranch Hand
Posts: 188
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
     
    Sudarshan Sreenivasan
    Ranch Hand
    Posts: 188
    IntelliJ IDE MySQL Database Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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.

     
    Ranch Hand
    Posts: 63
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I have sent link to this thread to Author of "SOA Using JavaTM Web Services"
    Adam
     
    Sudarshan Sreenivasan
    Ranch Hand
    Posts: 188
    IntelliJ IDE MySQL Database Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Ranch Hand
    Posts: 2198
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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!
     
    Sudarshan Sreenivasan
    Ranch Hand
    Posts: 188
    IntelliJ IDE MySQL Database Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    >
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic