Generate Client Web Service With Maven And Axis - web-services

I have a problem when Maven is generating the source code for a client web service with Axis.
I need consume the wsdl from url exposed by other company. For example, this is the wsdl content in url http://127.0.0.1:8080/ESBService/Example?wsdl
<wsdl:definitions xmlns:ns0="http://www.davivienda.com/xml/Example" xmlns:wsp200607="http://www.w3.org/2006/07/ws-policy" xmlns:wsp200409="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.davivienda.com/xml/Example">
<wsdl:types xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:schema>
<xsd:import schemaLocation="MySchema.xsd1.xsd" namespace="http://www.davivienda.com/xml/Example"/>
<xsd:import schemaLocation="MySchema.xsd2.xsd" namespace="http://www.davivienda.com/xml/Example"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Example_in">
<wsdl:part xmlns:xsns="http://www.davivienda.com/xml/Example" name="Example" element="xsns:Example"/>
</wsdl:message>
<wsdl:message name="Example_out">
<wsdl:part xmlns:xsns="http://www.davivienda.com/xml/Example" name="ExampleResponse" element="xsns:ExampleResponse"/>
</wsdl:message>
<wsdl:portType name="ExamplePortType">
<wsdl:operation name="Example">
<wsdl:input name="Example_Input" message="ns0:Example_in"/>
<wsdl:output name="Example_Output" message="ns0:Example_out"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ExampleExampleSOAP_HTTP_Binding" type="ns0:ExamplePortType">
<soap11:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="Example">
<soap11:operation soapAction="" style="document"/>
<wsdl:input name="Example_Input">
<soap11:body parts="Example" use="literal"/>
</wsdl:input>
<wsdl:output name="Example_Output">
<soap11:body parts="ExampleResponse" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ExampleExample_HTTP_Service">
<wsdl:port name="ExampleExample_HTTP_Port" binding="ns0:ExampleExampleSOAP_HTTP_Binding">
<soap11:address location="http://127.0.0.1:8080/ESBService/Example"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
And this is my pom file:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.axis</groupId>
<artifactId>client</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>client</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>org.codehaus.mojo</id>
<name>org.codehaus.mojo</name>
<url>http://repository.codehaus.org/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxrpc-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<versionRange>[1.4,)</versionRange>
<goals>
<goal>wsdl2java</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<urls>
<url>http://127.0.0.1:8080/ESBService/Example?wsdl</url>
</urls>
<packageSpace>com.example.axis.client</packageSpace>
<outputDirectory>${project.build.directory}/generated-sources/wsdl2java</outputDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
When I execute Run As->-generated sources in eclipse, Axis plugin couldn't read the schema from url and throw the following error:
[ERROR] Failed to execute goal org.codehaus.mojo:axistools-maven-plugin:1.4:wsdl2java (default) on project client: Error generating Java code from WSDL. Error running Axis: WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'MySchema.xsd1.xsd', relative to 'file:/E:/IDE/sts-bundle/workspaces/java/hermes-webapplet/client/target/axistools/wsdl2java/urlDownloads/http---127.0.0.1-ESBService-Example-wsdl.wsdl'.: This file was not found: file:/E:/IDE/sts-bundle/workspaces/java/hermes-webapplet/client/target/axistools/wsdl2java/urlDownloads/MySchema.xsd1.xsd -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:axistools-maven-plugin:1.4:wsdl2java (default) on project client: Error generating Java code from WSDL.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

Your problem is with the XSD mapping. Try to download the wsdl and XSD to your workspace and generate the Java classes:
<configuration>
<packageSpace>com.xyz</packageSpace>
<sourceDirectory>${basedir}/src/wsdl/rpc</sourceDirectory>
<outputDirectory>${basedir}/src/wsdl/rpc</outputDirectory>
</configuration

Related

JsonUtil cannot be resolved in WSO2 Integration Studio 8.0.0

I am using WSO2 Mediator Project to create JSON payload by using WSO2 Integration Studio 8.0.0.
Integration Studio ERROR:
JsonUtil cannot be resolved
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.test.in</groupId>
<artifactId>Jubilant_EmailTicketing</artifactId>
<version>1.0.0</version>
<relativePath>..\pom.xml</relativePath>
</parent>
<groupId>com.jubilant.in.Jubilant_EmailTicketing-Mediator</groupId>
<artifactId>Jubilant_EmailTicketing-Mediator</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<name>Jubilant_EmailTicketing-Mediator</name>
<description>Jubilant_EmailTicketing-Mediator</description>
<properties>
<CApp.type>lib/synapse/mediator</CApp.type>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.1.wso2v20</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20141113</version>
</dependency>
<!-- Requested Dependency -->
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-commons</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>Jubilant_EmailTicketing-Mediator</Bundle-SymbolicName>
<Bundle-Name>Jubilant_EmailTicketing-Mediator</Bundle-Name>
<Export-Package>com.jubilant.in</Export-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
</buildcommands>
<projectnatures>
<projectnature>org.wso2.developerstudio.eclipse.artifact.mediator.project.nature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
</projectnatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
added dependency file by following this
Still can't able to resolve this JsonUtil ERROR.
import Statement:
import org.apache.synapse.commons.json.JsonUtil;
Can anyone please help me to resolve this ERROR? or kindly suggest any Jar file for the same?
I resolved above JsonUtil ERROR by adding below dependency in pom.xml
Note: after iupdating pom.xml, i did mvn update by clicking alt+f5.
dependency:
<!-- https://mvnrepository.com/artifact/org.apache.synapse/synapse-commons -->
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-commons</artifactId>
<version>2.1.7-wso2v228</version>
</dependency>
Reference Link: click here

CXF codegen-plugin not working

I'm trying to get the cxf-codegen-plugin to generate sources from my wsdl file.
But Nothing happens when i execute mvn generate-source with eclipse luna.
It looks like plugin itself not configured properly.
My 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>
My 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>
Console Output
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9;
2014-02-14T23:07:52+05:30) Maven home:
D:\JSPractice\wsdlfirstwebservice\EMBEDDED Java version: 1.8.0_60,
vendor: Oracle Corporation Java home: C:\Program Files
(x86)\Java\jdk1.8.0_60\jre Default locale: en_IN, platform encoding:
Cp1252 OS name: "windows 7", version: "6.1", arch: "x86", family:
"dos" [INFO] Error stacktraces are turned on. [DEBUG] Reading global
settings from EMBEDDED\conf\settings.xml [DEBUG] Reading user settings
from C:\Users\D.Sama.m2\settings.xml [DEBUG] Using local repository
at C:\Users\D.Sama.m2\repository [DEBUG] Using manager
EnhancedLocalRepositoryManager with priority 10.0 for
C:\Users\D.Sama.m2\repository [INFO] Scanning for projects... [DEBUG]
Extension realms for project
com.webservice:wsdlfirstwebservice:war:0.0.1-SNAPSHOT: (none) [DEBUG]
Looking up lifecyle mappings for packaging war from
ClassRealm[plexus.core, parent: null] [DEBUG] === REACTOR BUILD PLAN
================================================ [DEBUG] Project: com.webservice:wsdlfirstwebservice:war:0.0.1-SNAPSHOT [DEBUG] Tasks:
[generate-sources] [DEBUG] Style: Regular [DEBUG]
======================================================================= [INFO] [INFO] Using the builder
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder
with a thread count of 1 [INFO]
[INFO]
------------------------------------------------------------------------ [INFO] Building wsdlfirstwebservice Maven Webapp 0.0.1-SNAPSHOT [INFO]
------------------------------------------------------------------------ [DEBUG] Lifecycle default -> [validate, initialize, generate-sources,
process-sources, generate-resources, process-resources, compile,
process-classes, generate-test-sources, process-test-sources,
generate-test-resources, process-test-resources, test-compile,
process-test-classes, test, prepare-package, package,
pre-integration-test, integration-test, post-integration-test, verify,
install, deploy] [DEBUG] Lifecycle clean -> [pre-clean, clean,
post-clean] [DEBUG] Lifecycle site -> [pre-site, site, post-site,
site-deploy] [DEBUG] === PROJECT BUILD PLAN
================================================ [DEBUG] Project: com.webservice:wsdlfirstwebservice:0.0.1-SNAPSHOT [DEBUG] Dependencies
(collect): [] [DEBUG] Dependencies (resolve): [] [DEBUG] Repositories
(dependencies): [central (http://repo.maven.apache.org/maven2,
releases)] [DEBUG] Repositories (plugins) : [central
(http://repo.maven.apache.org/maven2, releases)] [DEBUG]
======================================================================= [INFO]
------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO]
------------------------------------------------------------------------ [INFO] Total time: 0.101 s [INFO] Finished at:
2016-09-11T14:27:19+05:30 [INFO] Final Memory: 4M/15M [INFO]
You need to put cxf-codegen plugin in your build/plugins part, not only in build/pluginManagement/plugins.

cxf-codegen-plugin not generating code

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>
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>
I tried to run mvn clean install and the code generated successully

maven jax-ws plugin does not generate client classes from wsdl

I have created a web project using maven 2(it will be deployed on tomcat 7.0.35), which should serve as a client for JAX-WS web service. I am trying to generate client classes from wsdl file(I have 1 wsdl and 1 xsd).
After I run "mvn clean install" command, no classes are generated and I don't see any errors in console
This is my 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.test.ws</groupId>
<artifactId>my_ws</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>cs Maven Webapp</name>
<url>http://maven.apache.org</url>
<build>
<finalName>my_ws</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<projectNameTemplate>
[artifactId]-[version]
</projectNameTemplate>
<wtpmanifest>true</wtpmanifest>
<wtpapplicationxml>true</wtpapplicationxml>
<wtpversion>2.0</wtpversion>
<manifest>
${basedir}/src/main/resources/META-INF/MANIFEST.MF
</manifest>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
<wsdlFiles>
<wsdlFile>my_ws.wsdl</wsdlFile>
</wsdlFiles>
<packageName>com.test.ws.client</packageName>
<sourceDestDir>${basedir}/target/generated-sources/</sourceDestDir>
<keep>true</keep>
<bindingFiles>
<bindingFile>${basedir}/src/main/resources/wsdl/binding.xml</bindingFile>
<bindingFile>${basedir}/src/main/resources/wsdl/jaxb-binding.xml</bindingFile>
</bindingFiles>
</configuration>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>11.2.0.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.8</version>
</dependency>
</dependencies>
</project>
Here is binding.xml
<bindings
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
wsdlLocation="./my_ws.wsdl"
xmlns="http://java.sun.com/xml/ns/jaxws">
<!-- Disable default wrapper style -->
<enableWrapperStyle>false</enableWrapperStyle>
</bindings>
and jaxb-binding.xml
<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxb:globalBindings generateElementProperty="false" />
</jaxb:bindings>
When using <pluginManagement> element in a pom file, you don't declare plugins usage, but plugins availability. <pluginManagement> is used in a parent pom to announce available plugins for child pom usage.
Just remove this element, and the plugins should be called.

Why does this simple webservice (deployed to weblogic11g) receive this error: "wsa:MessageAddressingHeaderRequired"?

Problem:
I've re-created and deployed this very simple jax-ws webservice (see below) many times.
But, I've been unable to get this simple webservice app to work!
That is, when I submit the simple SOAP request (see "service request", below) I receive the following error: "wsa:MessageAddressingHeaderRequired"
QUESTION:
What is causing this error: "wsa:MessageAddressingHeaderRequired"?
MORE INFORMATION, BELOW...
Here is the implementation class...
package aaa.bbb.ccc;
import ccc.bbb.aaa.testws.ObjectFactory;
import ccc.bbb.aaa.testws.ResponseType;
import javax.jws.WebService;
#WebService(serviceName = "testws", portName = "testwsSOAP", endpointInterface = "ccc.bbb.aaa.testws.Testws", targetNamespace = "http://aaa.bbb.ccc/testws/", wsdlLocation = "WEB-INF/wsdl/testws.wsdl")
public class testws
{
public ccc.bbb.aaa.testws.ResponseType multiplyOperation(ccc.bbb.aaa.testws.RequestType request)
{
Integer value1 = new Integer(request.getParmValue1());
Integer value2 = new Integer(request.getParmValue2());
Integer product = value1 * value2;
ObjectFactory factory = new ObjectFactory();
ResponseType response = factory.createResponseType();
response.setValue1(value1.toString());
response.setValue2(value2.toString());
response.setProduct(product.toString());
return response;
}
}
Here is the WSDL...
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://aaa.bbb.ccc/testws/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testws"
targetNamespace="http://aaa.bbb.ccc/testws/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp1="http://www.w3.org/ns/ws-policy" xmlns:fi="http://java.sun.com/xml/ns/wsit/2006/09/policy/fastinfoset/service" xmlns:tcp="http://java.sun.com/xml/ns/wsit/2006/09/policy/soaptcp/service" xmlns:wsaw="http://www.w3.org/2005/08/addressing" xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" xmlns:sunrm="http://sun.com/2006/03/rm" xmlns:net="http://schemas.microsoft.com/net/2005/02/rm/policy">
<wsdl:types>
<xsd:schema targetNamespace="http://aaa.bbb.ccc/testws/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:Q1="http://aaa.bbb.ccc/testws">
<xsd:import schemaLocation="testws.xsd"
namespace="http://aaa.bbb.ccc/testws">
</xsd:import>
<xsd:element name="multiplyOperation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="request"
type="Q1:requestType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="multiplyOperationResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="response"
type="Q1:responseType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="multiplyOperationRequest">
<wsdl:part element="tns:multiplyOperation" name="parameters" />
</wsdl:message>
<wsdl:message name="multiplyOperationResponse">
<wsdl:part element="tns:multiplyOperationResponse"
name="parameters" />
</wsdl:message>
<wsdl:portType name="testws">
<wsdl:operation name="multiplyOperation">
<wsdl:input message="tns:multiplyOperationRequest" />
<wsdl:output message="tns:multiplyOperationResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="testwsSOAP" type="tns:testws">
<wsaw:UsingAddressing wsdl:required="true" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/>
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="multiplyOperation">
<soap:operation
soapAction="http://aaa.bbb.ccc/testws/multiplyOperation" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="testws">
<wsdl:port binding="tns:testwsSOAP" name="testwsSOAP">
<soap:address location="http://aaa.bbb.ccc/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Here is the XSD...
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://aaa.bbb.ccc/testws"
xmlns:tns="http://aaa.bbb.ccc/testws"
elementFormDefault="qualified">
<element name="query" type="tns:queryType"></element>
<complexType name="queryType">
<choice>
<element name="request" type="tns:requestType"></element>
<element name="response" type="tns:responseType"></element>
</choice>
</complexType>
<complexType name="requestType">
<sequence>
<element name="parmValue1" type="string"></element>
<element name="parmValue2" type="string"></element>
</sequence>
</complexType>
<complexType name="responseType">
<sequence>
<element name="value1" type="string"></element>
<element name="value2" type="string"></element>
<element name="product" type="string"></element>
</sequence>
</complexType>
</schema>
Here is the test request...
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header />
<env:Body>
<multiplyOperation xmlns="http://aaa.bbb.ccc/testws/" xmlns:tes="http://aaa.bbb.ccc/testws">
<request xmlns="">
<tes:parmValue1>3</tes:parmValue1>
<tes:parmValue2>4</tes:parmValue2>
</request>
</multiplyOperation>
</env:Body>
</env:Envelope>
Here is the test response...
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header>
<FaultDetail xmlns="http://www.w3.org/2005/08/addressing">
<ProblemHeaderQName>{http://www.w3.org/2005/08/addressing}Action</ProblemHeaderQName>
</FaultDetail>
</S:Header>
<S:Body>
<SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode xmlns:wsa="http://www.w3.org/2005/08/addressing">wsa:MessageAddressingHeaderRequired</faultcode>
<faultstring>A required header representing a Message Addressing Property is not present</faultstring>
</SOAP-ENV:Fault>
</S:Body>
</S:Envelope>
Here is the Maven build script I used...
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>aaa.bbb.ccc</groupId>
<artifactId>testwswaronly</artifactId>
<packaging>war</packaging>
<version>1</version>
<name>testwswaronly</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>webservices-rt</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>testws.wsdl</wsdlFile>
</wsdlFiles>
<staleFile>${project.build.directory}/jaxws/stale/testws.stale</staleFile>
</configuration>
<id>wsimport-generate-testws</id>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
<extension>true</extension>
<catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<webResources>
<resource>
<directory>src</directory>
<targetPath>WEB-INF</targetPath>
<includes>
<include>jax-ws-catalog.xml</include>
<include>wsdl/**</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<netbeans.hint.deploy.server>WebLogic9</netbeans.hint.deploy.server>
</properties>
</project>
Your WSDL contains:
<wsaw:UsingAddressing wsdl:required="true" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/>
Note that the required attribute is set to true. But your test request doesn't contain any headers:
<env:Header />
I believe that the response's FaultDetail header is telling you which request header was required:
<ProblemHeaderQName>{http://www.w3.org/2005/08/addressing}Action</ProblemHeaderQName>