Validating call to web service against schema before sending request
I am calling a web service (written in Java) in my web app. I use the WSDL to generate proxy classes using the wsdl.exe command line tool.
Everything is working fine开发者_如何学运维.
However, I have found out that the web service is not doing any data validation at all when they receive a request from my app. Hence, if I happen to send one minute piece of data that isn't exactly what they want, I receive a general fault error in return, with no specifics at all of what the incorrect (if any) piece of data is.
So, before I make the request, I'd like to validate my request against the schema they have provided. Is this possible, and if so, how do I go about this?
Thanks in advance
The proxy built from the wsdl already enforces whatever schema was provided unless, of course, the call takes a string parameter where you are supposed to pass xml. That would be bad design but if that's what you have to do, you can. Just use the XmlDocument object or the XmlReader to validate the XML.
精彩评论