web services - mvn - CXF codegen-plugin no funciona
wsdl to java maven (1)
Debe colocar el complemento cxf-codegen en su parte de construcción / complementos, no solo en build / pluginManagement / plugins.
Estoy intentando que cxf-codegen-plugin genere fuentes desde mi archivo wsdl. Pero nada sucede cuando ejecuto mvn generate-source con eclipse luna. Parece que el plugin no está configurado correctamente.
Mi pom.xml
<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/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.webservice</groupId>
<artifactId>wsdlfirstwebservice</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>wsdlfirstwebservice Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<jdk.version>1.8</jdk.version>
<cxf.version>3.0.4</cxf.version>
<jaxb.version>2.2</jaxb.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.0.4</version>
</dependency>
</dependencies>
<build>
<finalName>Wrsdlfirstwebservice</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
<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>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/CustomerOrders.wsdl</wsdl>
<bindingFiles>
<bindingFile>src/main/resources/wsdl/binding.xml</bindingFile>
</bindingFiles>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>${jaxb.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Mi wsdl
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="CustomerOrdersService"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.wsdlfirstwebservice.com/customerorders"
targetNamespace="http://www.wsdlfirstwebservice.com/customerorders">
<!-- Types -->
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.wsdlfirstwebservice.com/customerorders"
targetNamespace="http://www.wsdlfirstwebservice.com/customerorders">
<xs:complexType name="order">
<xs:sequence>
<xs:element name="id" type="xs:integer"/>
<xs:element name="product" type="tns:product" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="product">
<xs:sequence>
<xs:element name="id" type="xs:integer" minOccurs="0"/>
<xs:element name="description" type="xs:string" minOccurs="0"/>
<xs:element name="quantity" type="xs:integer" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="getOrdersRequest">
<xs:sequence>
<xs:element name="customerId" type="xs:integer" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="getOrdersResponse">
<xs:sequence>
<xs:element name="order" type="tns:order" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="getOrdersRequest" type="tns:getOrdersRequest"/>
<xs:element name="getOrdersResponse" type="tns:getOrdersResponse"/>
</xs:schema>
</wsdl:types>
<!-- Messages :
These are analogous to method parameters and return types in java methods
-->
<wsdl:message name="getOrdersRequest">
<wsdl:part name="parameters" element="tns:getOrdersRequest">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getOrdersResponse">
<wsdl:part name="parameters" element="tns:getOrdersResponse">
</wsdl:part>
</wsdl:message>
<!-- Port types
These are analogous to java methods. Port types use message as input and/or output.
-->
<wsdl:portType name="CustomerOrdersPortType">
<wsdl:operation name="getOrders">
<wsdl:input name="getOrdersRequest" message="tns:getOrdersRequest"></wsdl:input>
<wsdl:output name="getOrdersResponse" message="tns:getOrdersResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<!-- Bindings
This defines the message formats and protocol details for web service
-->
<wsdl:binding name="CustomerOrdersServiceSoapBinding" type="tns:CustomerOrdersPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getOrders">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="getOrdersRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getOrdersResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<!-- Service
Tells customer how to consume the service
-->
<wsdl:service name="CustomerOrdersService">
<wsdl:port name="CustomerOrdersPort" binding="tns:CustomerOrdersServiceSoapBinding">
<soap:address location="http://localhost:8080/wsdlfirstwebservice/services/CustomerOrdersService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Salida de consola
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T23: 07: 52 + 05: 30) Inicio de Maven: D: / JSPractice / wsdlfirstwebservice / EMBEDDED Versión de Java: 1.8.0_60, proveedor: Oracle Corporation Inicio de Java: C: / Archivos de programa (x86) / Java / jdk1.8.0_60 / jre Configuración regional predeterminada: en_IN, codificación de la plataforma: Cp1252 Nombre del SO: "windows 7", versión: "6.1", arco: "x86", familia: "dos" [INFO ] Error stacktraces están activados. [DEBUG] Lectura de la configuración global de EMBEDDED / conf / settings.xml [DEBUG] Lectura de la configuración del usuario desde C: / Users / D.Sama.m2 / settings.xml [DEBUG] Utilizando el repositorio local en C: / Users / D.Sama .m2 / repository [DEBUG] Uso del administrador EnhancedLocalRepositoryManager con la prioridad 10.0 para C: / Users / D.Sama.m2 / repository [INFO] Escaneo de proyectos ... [DEBUG] Reinos de extensión para el proyecto com.webservice: wsdlfirstwebservice: war: 0.0.1-SNAPSHOT: (ninguno) [DEBUG] Buscando mapeos de vidacyle para empaquetar war desde ClassRealm [plexus.core, parent: null] [DEBUG] === REACTOR BUILD PLAN =========== =============================================================================================================================== 0.0.1-SNAPSHOT [DEBUG] Tareas:
[generate-sources] [DEBUG] Estilo: Regular [DEBUG] ================================= ================================================================================================================ lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder con un número de subprocesos de 1 [INFO]
[INFO] ----------------------------------------------- ------------------------- [INFO] Building wsdlfirstwebservice Maven Webapp 0.0.1-SNAPSHOT [INFO] ---------- -------------------------------------------------- ------------ [DEBUG] Ciclo de vida predeterminado -> [validar, inicializar, generar-fuentes, procesar-fuentes, generar-recursos, procesar-recursos, compilar, procesar-clases, generar-probar- fuentes, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post- integración-prueba, verificación, instalación, implementación] [DEBUG] Ciclo de vida limpio -> [pre-limpieza, limpieza, limpieza posterior] [DEBUG] Sitio del ciclo de vida -> [sitio previo, sitio, sitio web posterior, implementación del sitio] [DEBUG] === PROJECT BUILD PLAN ====================================== ======= [DE ERROR] Proyecto: com.webservice: wsdlfirstwebservice: 0.0.1-SNAPSHOT [DEBUG] Dependencias (collect): [] [DEBUG] Dependencias (resolver): [] [DEBUG] Repositories (dependencias es): [central ( http://repo.maven.apache.org/maven2 , releases)] [DEBUG] Repositorios (complementos): [central ( http://repo.maven.apache.org/maven2 , releases) ] [DEBUG] =========================================== ====================== [INFO] ---------------------- -------------------------------------------------- [INFO] CONSTRUIR ÉXITO [INFO] ------------------------------------------ ------------------------------ [INFO] Tiempo total: 0.101 s [INFO] Finalizado en:2016-09-11T14: 27: 19 + 05: 30 [INFO] Memoria final: 4M / 15M [INFO]