cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhoffer <>
Subject How to specify XSD for WSDL definition
Date Tue, 12 Feb 2008 13:57:21 GMT

I am new to CXF and have a few questions.  I have used XFire before with good
success, however this is a different use case and I'm not sure how to

I want to create a web-service with a couple of simple methods where each of
them have either a input or output that is a type defined by XSD and
generated by JAXB 2.1 (lets call it JAXBGeneratedClass).  That is, I have a
jar with a JAXB generated type (JAXBGeneratedClass) that I want to pass
through the web-service/wsdl.  (JAXBGeneratedClass was generated with JAXB
2.1 and has annotations, I don't know if either is a problem as CXF, I
think, is using JAXB 2.0.)  For the other parameters in the web-service API
I don't really care how they are marshaled because they are not later
validating against an XSD.  Another way of stating this is 'how do you pass
data through a web-service that will be later validating against an XSD on
the server?'  (Note that I don't want to pass raw XML through the API
because then the clients would not have a typesafe data-bound API to work

Per the web site docs I did setup a web-service class/interface using
@WebService annotations and fired it up using the Jetty HTTP server, all is
running but I have the following questions/problems.  (I am using the maven
build/configuration approach.)

1. It seems wrong that I am letting CXF 'figure out' how to
marshal/data-bind JAXBGeneratedClass.  It seems that it would be better to
use the schema that generated JAXBGeneratedClass as part of the definition
of the WSDL (where-ever in the API it uses JAXBGeneratedClass I should use
the schema).  What I am trying to do here is not only create a 'service' API
but also I want to create client proxies in several languages, C++, Java,
NET, etc and it is important that they all be generated such that when the
data is passed to the web-service it is valid per the schema used to
generate JAXBGeneratedClass.  (Currently, it seems, that CXF does not know
about my original XSD rather it is figuring out how to marshal something
that was JAXB generated from my schema.)

2.  How do I make sure that in all the client languages, the data is
validated on the client.  That is, I don't want them to guess what is
required and what is optional (as specified in the schema) and only find out
when the web-service API fails.  Either the client generated code has to be
generated such that instances cannot be created that are invalid or schema
validation has to occur on the client as well.  With JAXB, for instance, it
just generates java beans with no validation; one doesn't know if the
content is correct until it is saved to XML with validation.  This would not
work, it seems, because the client would never be 'saving' thus never be

I will try to generate a java client using CXF and see what it generates. 
If anyone can point me in the right direction on how to do this it would be
much appreciated.

View this message in context:
Sent from the cxf-user mailing list archive at

View raw message