Typically I prefer not to use a bunch of
different schemas with a service (e.g., one schema for each element and type). In
order to reference an element (or type) from one schema (a) in another schema
(b), you must explicitly import the (a) schema (and define a namespace
declaration) into the (b) schema using <xsd:import>. Likewise, if the (b)
schema needs to reference an element or type from the (a) schema, you must also
explicitly import the (a) schema in the (b) schema. So using lots of separate
schemas requires lots of schema imports. I suggest you factor schemas into the
appropriate sizes to support your requirements for reusability. In other words,
if you plan to use a particular element (or type) in a number of different
applications, combining the element with a different set of elements in each
application, then it makes sense to define it in a separate schema. But if you
typically use that element with the same group of elements in most of your
applications, then you probably want to define them in the same schema. My recommendation, therefore, is to define
your service’s data elements (customer, purchase order, etc) and their types
in a single schema unless you have a compelling reason to factor them into
separate schemas. I also recommend that you follow
Henrik’s advice to define your service’s input and output message
elements in a separate schema from your data element schema. (You will need to
<xsd:import> your data element schema into the message element schema.) If
the particular set of message elements will be used only by your service, then
you can define them within the <types> section of your WSDL. (This
situation is reasonably typical because the input message element usually has
the same name as the operation so tends to be pretty unique to the particular
service). But if you anticipate that you may have multiple services that wish
to exchange the same messages, then you probably want to factor the message
elements into a standalone schema. I suspect you’re more likely to reuse
fault messages than input and output messages, so it makes sense to factor
fault messages into a separate schema. Note that a WSDL document may have at most
only one <types> section, so you can’t <wsdl:import> multiple
types sections into a WSDL document. If you want to import multiple schemas,
you must import them from within your <types> section, and you must use
<xsd:import> to do so. Regards, Anne From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Thanks,
Henrik. That's
the sort of thing I'm after. I
couldn't quite work out the difference between 1 and 2, though. In 1, you are
defining the messages for the service methods and this naturally includes the
parameters of the methods. In 2, it seems you're doing the same thing again
(except for the message elements themselves). When
importing, are you referring to WSDL imports or XML schema imports? We have
some services that define a schema in the <types> element and import
another schema, in the <types> element also. The latest SOAPscope doesn't
like this, unless the imported schema is imported within the schema which
references its types. Just thought I'd mention it (XMLSpy, doesn't mind). Keep it
coming! Tony |
- Re: Best Practice Joe Plautz
- Re: Best Practice HG
- Re: Best Practice Anand Natrajan
- Re: Best Practice Joe Plautz
- Re: Best Practice Anand Natrajan
- Re: Best Practice HG
- Re: Best Practice tony . q . weddle
- Re: Best Practice HG
- RE: Best Practice Anne Thomas Manes
- RE: Best Practice Anne Thomas Manes
- RE: Best Practice Anne Thomas Manes
- RE: Best Practice Anne Thomas Manes
- Re: Best Practice HG
- RE: Best Practice Anne Thomas Manes
- RE: Best Practice Anne Thomas Manes
- Re: Best Practice HG
- Re: Best Practice HG
- RE: Best Practice Anand Natrajan
- Re: Best Practice Jim Murphy
- Re: Best Practice Anand Natrajan
- RE: Best Practice Anne Thomas Manes