Home » Java » java – Apache CXF java2wsdl: Custom symbol names-Exceptionshub

java – Apache CXF java2wsdl: Custom symbol names-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment


Our java application needs to communicate with a SOAP service. We use Apache CXF to implement a jaxws client. The classes are generated by wsdl2java from the WSDL file we received from the service provider.

Unfortunately the symbol names provided by the service are all uppercase and underscore delimited (e.g. PRODUCT_ATTACHMENT). This is very confusing as it differs from the typical “CamelCase” java coding convention (e.g. ProductAttachment).

I know you could define custom mappings for each class. But as there is a huge number of classes and members, I’d like to automate the symbol name conversion.

So I wonder if there is a way to provide some kind of rules or piece of java code (as hook) for wsdl2java which tells it to convert a symbol name ABC_DEF to AbcDef in the generated java classes.

If not, maybe there are alternative solutions instead of Apache CXF which allow this.

How to&Answers:

You could try to use camelcase-always plugin. There were examples on stackoverflow of its integration with maven-jaxb2-plugin.

Example configuration for cxf-codegen-plugin: