468,110 Members | 1,557 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,110 developers. It's quick & easy.

Validating parameters to Web Service

Has .NET any XML-based validation framework or tool classes to validate
parameters passed to an Web Service?

I need only couple of types validation
- is parameter passed to Web Service method empty
- does parameter belong to certain value set which is mentioned
earlier somewhere in XML files.
So, very simple validation.

Cheers!
Jan 4 '06 #1
1 3368
Hi Jackie,
Has .NET any XML-based validation framework or tool classes to validate
parameters passed to an Web Service?

I need only couple of types validation
- is parameter passed to Web Service method empty
- does parameter belong to certain value set which is mentioned
earlier somewhere in XML files.


Unfortunately, the Framework won't make these types of checks for you. It
can throw an exception if a parameter is of wrong type (for example, a
string instead of an integer), but other than that, you would need to check
the parameters yourself.

Checking for an empty string for example is very simple, but matching
against a list of values required some more lines of code. The exact code
would of course depend on your XML file format, etc. One way to read your
XML files would be to use the XmlTextReader class. This is a good solution
of your XML files are very simple.

Hope this helps.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Jan 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Shazad | last post: by
5 posts views Thread by sourabh | last post: by
3 posts views Thread by =?Utf-8?B?UGllcnJl?= | last post: by
reply views Thread by =?ISO-8859-1?Q?Jan_Thom=E4?= | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.