Pierre,
In XML Schema, an element declaration describes an element that will
appear in an XML document. A type declaration (complexType or
simpleType) describes a type (i.e., the structure of an element and
the type of data that the element contains). It's comparable to the
relationship between an object and a class. All elements have a type.
If the type has not been specified, it defaults to xsd:anyType.
If you have previously defined an element and then want to use it as a
child of another element, you must reference the element rather than
redefine it, e.g.:
<s:element name="foo" type="s:string"/>
<s:element name="bar">
<s:complexType>
<s:sequence>
<element ref="foo"/>
</s:sequence>
</s:complexType>
</s:element>
In a WSDL message description, a WSDL part may reference an element or
a type. If the SOAP binding specifies style="document", then the WSDL
part must reference an element. If the SOAP binding specifies
style="rpc", then the WSDL part must reference a type.
Anne
On Thu, Jun 19, 2008 at 1:07 AM, pierre betz <[EMAIL PROTECTED]> wrote:
> hi everyone, I work on web services for some time now, but I still have this
> question in my head.. and don't find any answer..
> what is the true difference between type and element in a schema/wsdl ?
>
> in the wsdl file, for a message : (from the \axis2-1.3\samples\databinding
> sample !)
>
> everytime I must declare a part, even if it's empty. is that right ?
> (wsdl2jave with xmlbeans will not work if there is no part)
>
> <message name="getStockQuoteReq">
> <part name="parameters" element="tns:getStockQuote" />
> </message>
>
> and the element :
> <xsd:element name="getStockQuote">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="symbol" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
>
> so here, the getStockQuote is defined as an element. ok, why not.
>
>
> but now, here is the complete schema, and you will see :
> <xsd:element name="quote">
> <xsd:complexType name="changeType">
>
> so, you declare an element when it is the part of the message ? and a type
> when it's a part of element ?
>
> and the <xsd:element name="getStockQuoteResponse"> :
>
> it is the response, so, ok, maybe it have to be declared as element.
> but : <xsd:element ref="quote" />
> what does that mean ? that the response element will be the same form as
> <xsd:element name="quote"> ?
>
>
>
> <xsd:schema
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> targetNamespace="http://w3.ibm.com/schemas/services/2002/11/15/stockquote"
> xmlns="http://w3.ibm.com/schemas/services/2002/11/15/stockquote">
>
> <xsd:element name="quote">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="symbol" type="xsd:string"/>
> <xsd:element name="volume" type="xsd:integer"/>
> <xsd:element name="lastTrade" type="lastTradeType"/>
> <xsd:element name="change" type="changeType"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
>
> <xsd:complexType name="changeType">
> <xsd:sequence>
> <xsd:element name="dollar" type="xsd:float"/>
> <xsd:element name="percent" type="xsd:float"/>
> <xsd:element name="positive" type="xsd:boolean"/>
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:complexType name="lastTradeType">
> <xsd:sequence>
> <xsd:element name="price" type="xsd:float"/>
> <xsd:element name="date" type="xsd:long"/>
> </xsd:sequence>
> </xsd:complexType>
>
> <!-- Methods signatures -->
> <xsd:element name="getStockQuote">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="symbol" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="getStockQuoteResponse">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="quote" />
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
>
> </xsd:schema>
>
>
>
>
> thanks a lot for the explanations !
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]