开发者

What's the best way to do XMLObject Validation

I'm doing Sprimg WS at my workplace. We run into some strange validation problems, where if a user passes "Dog" for a boolean value. It still accepts it and blows up. I would like to know what's the best way to handle this kind of problem.

Requirement:

Based on the SOAP request, If there are any validation errors, return the set of customized errors back to the user.

Technology used, XMLObject for XML to Object translation.

Current way to validate (Which I feel can be improved) Checking if the element is Nil and is Set for each and every element in the XML.

What I tried?

I tried to use XMLObject Validate method, Which I suppose just returns one error at a time. Which is not feasible for us. I want to send the list of errors which the request forgot to comply with the XML Schema.

Plea开发者_运维技巧se suggest me some ways to proceed with this , which could be efficient.


You should validate against your XSD schema(s) in your WSDL.

I have written a tutorial with server validation here and a tutorial with client validation here that hopefully gives you some suggestions!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜