Case

My previous subject was the following: considering a WSDL that was generated by Axis 2, develop a webservice with CXF and/or SpringWS in “contract first” (ie the contract seen as an API is given, Java code comes afterwards) approach.

It cannot work easyly, unless you are ready to spend time, money and energy in creating adapters and adding layers in your application architecture.

CXF

With CXF, the first step is to generate Java code with the wsdl2java embeded in Maven CXF plugin. The output is explicit:

Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.6.1:#wsdl2java on project PocEjb3: Rpc/encoded wsdls are not supported with #CXF

RPC vs Encoded

Actually, the SOAP envelope has two ways to transport the message: RPC and Document. More detail is available here: Which style of WSDL should I use?
Axis 2 generates RPC/encoded webservice ; this method is deprecated, CXF does not support it.

Spring WS

I then tried to use Spring WS. I thought “Spring WS is only contract-first, it should work”. The first pitfall I fell on was that SpringWS bases on XSD files, not on actual WSDL. For instance, if you follow SpringWS tutorial, you will find such a block: