By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,852 Members | 2,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,852 IT Pros & Developers. It's quick & easy.

Help - how to set WSDL minOccurs=1 for WebMethod argument properties?

P: n/a
I'm defining a C# WebMethod where the argument has properties that are
mandatory:

[WebMethod]
public bool PerformTask(SimpleObject simpleObject)
{
....
}

where SimpleObject is as follows:

public class SimpleObject
{
private string _name;

public SimpleObject()
{
}

public string MyName
{
get
{
return _name;
}
set
{
_name = value;
}
}
}

However, upon viewing the generated WSDL associated with this object, I
see the following:

<s:complexType name="SimpleObject">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="MyName"
type="s:string" />
</s:sequence>
</s:complexType>

This is a required property of the object for the application, and it
would be best to publish that fact in the generated WSDL instead of
adding application logic in my code to check this value and return an
error message if the required values are not populated. Is there any
attribute or mechanism that I can use which will result in a
specification that an object property is required in the generated WSDL
(minOccurs=1)?

Thanks in advance

Mar 23 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.