You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by kasturi1010 <ka...@gmail.com> on 2008/09/16 00:11:08 UTC

How to perform XML Schema validation?

SHORT VERSION OF THE QUESTION:
My question is how do I validate an XML instance to contain the exact data
types/restrictions as specified in the XSD/WSDL, e.g clients sending strings
for elements where xsd:double or xsd:date is expected should be thrown an
appropriate exception. 

Initially I expected the CXF engine to do such validation for me, until I
stumbled on this thread.
http://www.nabble.com/helloworld-sample-simpleType-restriction-not-working-td10790436.html#a10795999

So how do I add in in-handlers to do such validation? Can anyone point me to
a code sample or provide one here?

Thanks,
Kasturi

LONG VERSION OF THE QUESTION

I am just extracting the request xsd from the  part of my wsdl for brevity. 

<?xml version="1.0" encoding="UTF-8"?>



    
    
    
    	
    		
    		
    	
    

    
    	
    		
    		
    		
    		
    	
    

    
    	
    		
    		
    		
    		
    		
    	
    


I am following the contract-first approach where-in I:
1. Design the above xsd for both request and response.
2. Generate the corresponding implementation message bean classes using XJC
task of JAXB2.0
3. Annotate the service classes with @WebService etc
4. Deploying the war whereby the other details of WSDL automatically get
generated.

So how do I verify that clients send me dates for  element? I just sent 

                    hi
                    2008-08-08
                    2008-08-08
                    hello


and the request went fine all through which shouldn't have been the case.
                
-- 
View this message in context: http://www.nabble.com/How-to-perform-XML-Schema-validation--tp19502123p19502123.html
Sent from the cxf-user mailing list archive at Nabble.com.