2
votes

Is there a way to configure Apache CXF wsdl2java to generate a constructor with all of a classes fields in it? Right now only the empty default constructor is generated as well as void returning setters. This can result in very unwieldy code. I'm transitioning from axis 1.4 which did generate full constructors, so a lot of code is broken as a result.

I'm running wsdl2java from the command line. I'm not using maven/ant, just trying to generate the java files so a maven plugin will not work for me.

1

1 Answers

0
votes

What you'd want to find is a JAXB plugin that makes this happen. I'm not aware of one. Instead of a constructor setting all fields, you're better off with fluent setters. There is a JAXB plugin to do that, called "jaxb-fluent-api". I would expect you could eventually build a nasty wsdl2java command line that does this, but you're better off writing an actual build script, using Maven hopefully.

See these examples of referencing JAXB extensions with the "cxf-codegen-plugin".