Contract first and code first approaches
Both contract first and code first development modes are fully supported by Quarkus CXF.
Contract first client
A SOAP service is described by WSDL.
It is a contract defining operations, their parameters and return values, etc.
WSDL is rich enough to be used for generating the code of a complete client.
CXF provides the wsdl2java
utility for that.
Quarkus CXF wraps wsdl2java
in the quarkus-cxf
extension so you do not need to use it directly.
Follow the Generate the Model classes from WSDL section of the user guide for more details about how to use it.
You may also want to check the CXF Developing a Consumer as a general introduction.
Contract first service
When implementing a service the generation of Java code from WSDL
may also come in handy.
wsdl2java
can generate the model classes (with JAXB annotations)
and service interfaces (with JAX-WS annotations) for you.
Your task is then to provide implementations for those interfaces.
You may want to check the WSDL First Service Development section of CXF documentation for a better understanding of the underlying concepts.
Code first service
Another valid option at your disposal is to write your service in Java, using JAX-WS and JAXB. Then you have two options how to obtain the WSDL contract:
-
Start your service and point your clients at
http://your-host/your-service?wsdl
-
Generate the WSDL document from Java classes at build time
Check the Code first development section of CXF documentation for further information. |