On Wednesday 15 August 2007, Jason Rosenberg wrote: > I am interested in trying to create some complex xsd types, using code > first development.... > > So far, I've seen how to do some things, like create enums by using > the @XmlEnum annotation, etc.... > > What i haven't come accross is a way to specify some of the > interesting restriction facets, like:
I don't think JAXB support saving those things in the annotations. Most of the facet things aren't recorded. Even things like minOccurs and maxOccurs are not recorded. > And there are several other more examples here: > http://www.w3schools.com/schema/schema_facets.asp > > Are these type restrictions meant to be enforced if specified in the > wsdl as such, within JAXWS and CXF? > > e.g. if I specified these types for parameters, when using wsdl first > development, and then tried to pass values that don't comply to the > restrictions, should I expect a WebFault to be thrown? Well, yes and no. By default, CXF does not turn on schema validation as it can be expensive. However, there is a flag that can be set on the client/endpoint to turn on the validation if the schemas are available. In that case, JAXB will throw an exception if you try to read/write data that is invalid. From spring config, you can do something like: <jaxws:endpoint name="{http://apache.org/hello_world_soap_http}SoapPort" wsdlLocation="wsdl/hello_world.wsdl" createdFromAPI="true"> <jaxws:properties> <entry key="schema-validation-enabled" value="true" /> </jaxws:properties> </jaxws:endpoint> which would turn on the schema validation. -- J. Daniel Kulp Principal Engineer IONA P: 781-902-8727 C: 508-380-7194 [EMAIL PROTECTED] http://www.dankulp.com/blog
