You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christopher Moesel <Ch...@avid.com> on 2007/05/08 18:29:35 UTC

Code-First Services: Annotation Hell?

Hello,

I was helping someone try a CXF code-first service and found a few
interesting gotchas.  It mainly came down to what is required if you
have custom types...

Assume I have the method:

MyResult doOperation(MyParam p);

In order to make the code-first service work correctly (i.e.
interoperable with C# or Axis for instance), it is not enough to just
specify a targetNamespace for the Interface.

I had to annotate the MyResult and MyParam classes with the @XmlType
annotation and specify the namespace.  In addition, I had to annotate
each getter in the Java classes with @XmlElement and specify a
namespace.  This made for a lot of annotations, all just to specify the
same namespace for each one!

If I did not do that, the elementFormDefault attribute of the xsd:Schema
was set to false, and this made the service break with a C# client.

Is this a bug in CXF, or is the intention really to make people annotate
every single class and property?  If this is the case, what if you don't
have access to the source code of some of the custom Java classes you
want to use?

-Chris