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


Alan Chen

I am writing my first web service, here is the signiture of my
webmethod in C#:
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" />

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

Alan Chen



Girish bharadwaj

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).

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. After that, you can post your question and our members will help you out.

Ask a Question