简体   繁体   中英

Is there any way to perform validation with xsd before calling a web service method

I have a wcf webservice which has several methods. I also have several xsd schemas that i want to use to validate created xmls. What i am curious about is there any way to perform validation before making a web service call ? If it is valid make the request, if not stop and return the xsd validation message.

For instance,

I have a method that makes member registration. Lets say It has name and age parameters. I want to check that user doesn't enter string to the age parameter before making the ws call. Also how to import these xsd files to the client machine ? Is there any way to generate them on client by wsdl or some other way ?

If it is a case of type or format input this should probably be done on the client with the UI layer to save any processing.

If you have a web based client using MVC you can easily add attributes to the model to validate the input, if you have a SPA utilizing a javascript framework like angularJS, this could all be done on the client side before the user can even submit the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM