Why generate minOccurs='0' while the parameter is not optional?

Discussion in 'ASP .Net Web Services' started by Alan Chen, Sep 2, 2004.

  1. Alan Chen

    Alan Chen Guest

    Hi,
    I am writing my first web service, here is the signiture of my
    webmethod in C#:
    [WebMethod]
    public string Request(
    string productType,
    double version,
    out string confirmationID
    )

    And here is part of the generated WSDL file:
    - <s:element name="Request">
    - <s:complexType>
    - <s:sequence>
    <s:element minOccurs="0" maxOccurs="1" name="productType"
    type="s:string" />
    <s:element minOccurs="1" maxOccurs="1" name="version"
    type="s:double" />
    </s:sequence>
    </s:complexType>
    </s:element>

    My question is why minOccures="0" for productType even if it is not
    optional.
    I know there is no optional parameters for webmethod, but the WSDL
    file might confuse users.
    Thanks for your help!

    Alan Chen
     
    Alan Chen, Sep 2, 2004
    #1
    1. Advertisements

  2. I am thinking because String can be nulled out.. I.e. caller can pass no
    productType and it will come through as a null string (guessing, really).
     
    Girish bharadwaj, Sep 11, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.