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 !

Reply via email to