Glen, I initially had some trouble where Tomcat 6.0.20 was being finicky deploying the war file, but Tomcat 6.0.29 did a better job, and I was able to get your example up and running. I then modified the WSDL so that "numberToDouble" and "doubledNumber" have numeric constraints, and it works, reporting incoming and outgoing validation errors properly. I can now use this validation example as a reference, to figure out why validation isn't being enabled properly in my project.
Thanks! - Aaron -----Original Message----- From: Glen Mazza [mailto:[email protected]] Sent: Tuesday, December 14, 2010 12:58 PM To: [email protected] Subject: Re: Enabling jaxws schema validation through CXF? Hi Aaron -- might this blog entry help you: http://www.jroller.com/gmazza/entry/soap_xml_schema_validation Regards, Glen On 12/14/2010 12:46 PM, Pieper, Aaron wrote: > Hello, > > > > I am trying to enable incoming schema validation on a CXF endpoint. I > know this is a very common question. I am using CXF 2.3.0. I tried > adding the annotation to my web service, and I also tried the > "jaxws:properties" approach, modifying my cxf-servlet file. Both of > those approaches worked, kind of - but they only enable outgoing > validation. Incoming messages are still unvalidated, and I'm not sure > why. > > > > I'm 90% sure the problem is on my side, so my real question is - is > there one of the code samples in CXF which I can easily tweak to enable > validation, so that I can see how it's supposed to work? Or are there > any of the examples which already have validation enabled? The closest > thing I could find was the wsdl-first examples, which are a little > broken I think. > > > > The "wsdl_first_soap12" Client.java has a try/catch block which says > something along the lines of, "Invoking greetMe with invalid length > string, expecting exception..." but, the exception isn't thrown, and the > test passes anyways, since there's no "Assert.fail" in the try block. > > > > I also looked at the "wsdl_first" project because its cxf.xml had the > jaxws validation tags in it. The wsdl_first project didn't work out of > the box, because the pom.xml file referenced a "hello_world.wsdl" which > didn't exist. After fixing that, though, schema validation is still not > enabled - it seems like the "mvn -Pserver" sidesteps the cxf.xml > configuration file, the endpoint is configured in the > CustomerServiceServer.java file. > > > > What is the easiest way to get an example up and running with incoming > schema validation? I have been running most of the examples with the > "mvn -Pserver" approach which seems like it would not activate any of > the annotations or any of the CXF configuration files which trigger > validation. Do I have to modify one of the examples to enable XSD > validation, launch a standalone tomcat instance, build a war file, and > deploy the war file into that instance? Or is there a simpler way? > > > > Thanks, > > > > - Aaron > > > >
