Validating parameters to Web Service

  • Thread starter Thread starter Jackie W
  • Start date Start date
J

Jackie W

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!
 
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
(e-mail address removed)
http://www.saunalahti.fi/janij/
 

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

Back
Top