I am using cxf-codegen-plugin to generate my WSDL classes in Java, I want to add Soap Headers to the request, but they are not generating in the plugin. How do I add them?
This is my defined plugin:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>4.0.2</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<defaultOptions>
<extraargs>
<extraarg>-p</extraarg>
<extraarg>com.smartcode.springenterpriseapi.stub.target</extraarg>
</extraargs>
</defaultOptions>
<wsdlOptions>
<wsdlOption>
<wsdl>${project.basedir}/src/main/resources/enterprise.wsdl</wsdl>
<extraargs>
<extraarg>-autoNameResolution</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
<includes>
<include>${project.build.directory}/generated-sources/cxf/**</include>
</includes>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
I have been looking to see if there is an configuration or how you can add it to the Java object.
I figured out the answer. I thought the generated classes from cxf-codegen-plugin would somehow establish the relationship from the soap envelope with the body and the headers, but it doesn't, you have to add an interceptor.
Then, you can call it when you establish your client.