Benson: I take your point that perhaps I'm asking more than the tools can do, but am left wondering why you might discourage the use of reusable elements within a web service. Is it not typically done? I was thinking that it would simplify data validation - by the time you made it through a schema-aware parser, you would know that the data would be valid as well as correctly formatted.
Ah well, at least apples and coconuts does seem like a tasty combo to me personally... :-) David -----Original Message----- From: Benson Margulies [mailto:bimargul...@gmail.com] Sent: Tuesday, May 31, 2011 12:41 PM To: users@cxf.apache.org Subject: Re: Schemas inside WSDL David, I think you are mixing apples and coconuts a bit here. The schema in a WSDL is XSD. What you are looking at it the process of auto-generating XSD from Java with annotations, apparently with JAX-B. JAX-B supports only a subset of XSD. Many restrictions and other refinements that you can express in XSD have no representation in plain JAX-B. In some cases you can add JAX-B plugins that get you more. If you use the JAX-B tool to generate Java from your XSD, you can see just how much gets thrown away. If you really need to use a highly-specialized schema to express your web service (which I might discourage), you can't use JAX-B in Java-first mode. You can use schema-first, and then enable schema validation. On Tue, May 31, 2011 at 11:21 AM, David Sills <dsi...@datasourceinc.com> wrote: > I'm having some trouble understanding exactly how to relate XSD types I > already have to WSDL, where I want to reuse them. If someone could point > me in a good direction, I'd be very grateful. > > I have, for instance, a schema in which I define: > > <xs:simpleType name="ssn-type"> > <xs:restriction base="xs:string"> > <xs:pattern > value="[1-8][0-9]{8}|(?:0(?!0{8}))[0-9]{8}|(?:9(?!9{8}))[0-9]{8}"/> > </xs:restriction> > </xs:simpleType> > > (a standard SSN but not all 0s or all 9s - this is the customer's > requirement) > > I would like to use this to validate the SSN (in the WSDL, in other > words) for this class: > > @XmlType(name = "Identity") > public class IdentityImpl implements Identity > { > private String ssn; > // a bunch of other properties > > /** > * @see com.datasourceinc.abis.ws.fingerprint.Identity#getSsn() > */ > @Override > public String getSsn() > { > return ssn; > } > > public void setSsn(String ssn) > { > this.ssn = ssn; > } > // the rest of the getters and setters > > I have tried a variety of annotations on the getSsn() method and the > entire class without success. Can anyone suggest anything that will do > what I want? > > Thanks! > > David Sills > >