Reputation: 43
I am attempting to use Maven to generate Java from a WSDL. I'm not that familiar with Maven, so it doesn't surprise me that I'm getting something wrong.
Running mvn generate-sources
, I get this output
$ mvn generate-sources
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building data-mgmt-ws 1.0
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.188 s
[INFO] Finished at: 2015-10-27T23:19:20-05:00
[INFO] Final Memory: 5M/92M
[INFO] ------------------------------------------------------------------------
No errors, but no classes either.
This is the relevant part of my POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/OM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mil.army.sddc.ibs.ccr</groupId>
<artifactId>data-mgmt-ws</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<properties>
<cxf.version>3.0.2</cxf.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/dataMgmt.wsdl</wsdl>
<serviceName>DataMgmtService</serviceName>
</wsdlOption>
</wsdlOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
This is my WSDL:
<?xml version="1.0"?>
<wsdl:definitions name="DataMgmtService"
targetNamespace="http://ccr.ibs.sddc.army.mil/DataMgmt.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://ccr.ibs.sddc.army.mil/DataMgmt.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<message name="SayHelloRequest">
<part name="firstName" type="xsd:string"/>
</message>
<message name="SayHelloResponse">
<part name="greeting" type="xsd:string"/>
</message>
<portType name="DataMgmt_PortType">
<operation name="sayHelloWorld">
<input message="tns:SayHelloRequest"/>
<output message="tns:SayHelloResponse"/>
</operation>
</portType>
<binding name="DataMgmt_Binding" type="tns:DataMgmt_PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sayHelloWorld">
<soap:operation soapAction="sayHelloWorld"/>
<input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding"
namespace="mil.army.sddc.ibs.ccr.DataMgmtWebService"
use="encoded"/>
</input>
<output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding"
namespace="mil.army.sddc.ibs.ccr.DataMgmtWebService"
use="encoded"/>
</output>
</operation>
</binding>
<service name="DataMgmt_Service">
<port binding="tns:DataMgmt_Binding" name="DataMgmt_Port">
<soap:address location="http://ccr.ibs.sddc.army.mil/SayHelloWorld"/>
</port>
</service>
</wsdl:definitions>
Upvotes: 3
Views: 4650
Reputation: 137269
In your configuration of cxf-codegen-plugin
, you forgot to specify the goal wsdl2java
. Thus, the execution of the plugin is not invoked.
Correct configuration:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal> <!-- goal this execution is bound to -->
</goals>
<configuration>
<sourceRoot>generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/dataMgmt.wsdl</wsdl>
<serviceName>DataMgmtService</serviceName>
</wsdlOption>
</wsdlOptions>
</configuration>
</execution>
</executions>
</plugin>
Upvotes: 4