wsimport fail with maven - web-services

I'm trying to create an ssl webservice client using maven and netbeans(7.2).
The webservice is perfectly working and I test it using an ant project.
When I try to build the project and generate webservice stubs I get this error:
Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.2:wsimport (wsimport-generate-test_project_ws_v1) on project mavenproject3: Error executing: wsimport [-keep, -s, C:\Users\no_name\Documents\NetBeansProjects\mavenproject3\target\generated-sources\jaxws-wsimport, -verbose, -encoding, UTF-8, -extension, -Xnocompile, -catalog, C:\Users\no_name\Documents\NetBeansProjects\mavenproject3\src\jax-ws-catalog.xml, -wsdllocation, https://localhost:8181/test_project_ws_v1/test_project_ws_v1?wsdl, file:/C:/Users/no_name/Documents/NetBeansProjects/mavenproject3/src/wsdl/localhost_8181/test_project_ws_v1/test_project_ws_v1.wsdl]: UndeclaredThrowableException: javax.xml.bind.annotation.XmlElementRef.required() -> [Help 1]
This is my pom (generated by netbeans)
<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.procc</groupId>
<artifactId>mavenproject3</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mavenproject3</name>
<url>http://maven.apache.org</url>
<build>
<resources>
<resource>
<targetPath>META-INF</targetPath>
<directory>src</directory>
<includes>
<include>jax-ws-catalog.xml</include>
<include>wsdl/**</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<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>localhost_8181/test_project_ws_v1/test_project_ws_v1.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>https://localhost:8181/test_project_ws_v1/test_project_ws_v1?wsdl</wsdlLocation>
<staleFile>${project.build.directory}/jaxws/stale/test_project_ws_v1.stale</staleFile>
</configuration>
<id>wsimport-generate-test_project_ws_v1</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>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>webservices-rt</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Thanks.

I was having the same error recently.
It seems that it happens because wsimport messes with 2.1 and 2.2 versions of jaxb.
I was able to generate the Web Services sources correctly by editing the project pom.xml and adding a <target>2.1</target> tag to the configuration of each imported wsdl, like this:
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>path/to/file.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>http://path/to/webservice?wsdl</wsdlLocation>
<staleFile>path/to/file.stale</staleFile>
<target>2.1</target>
</configuration>
<id>wsimport-generate-WebServiceName</id>
<phase>generate-sources</phase>
</execution>
Hope it helps whoever is having this issue.

We had a similar issue. When doing a wsimport we got a command line error stating -encoding was an invalid parameter.
Looking in the POM, and the plugin section for jaxws-maven-plugin the following dependency existed:
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.2.5</version>
</dependency>
</dependencies>
Removing this fixed the issue. We were also using version 2.3 of jaxws-maven-plugin

I could build on one machine but not another - the issue was caused by environment variables
Check your maven environment variables, M2 and M2_HOME
M2_HOME - "<Apache-maven-root-directory>" e.g. ("C:\Tools\apach-maven")
M2 - "%M2_HOME%\bin" (For windows machine)

Related

Maven using local spark library

Due to a recent EKS update on AWS I was not anymore able to run spark jobs on AWS (kubernetes client version had to be upgraded).
Therefore, I have been building the last Spark snapshot version (2.4.5-SNAPSHOT, it contains the bugfix I need) successfully.
Now I want to add it to my project, replacing the old 2.3.3 version.
Unfortunately I get some compilation error (see below).
I am probably doing something wrong with my pom.xml file. The final goal is to fetch jar files from remote and from local (the repo)
Ideas?
Thanks!
P.s.
Ubuntu 18.04 + intellij
The relevant part of the pom.xml file are the following:
<?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/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
I add my local repo...
<!-- My local repo where the jar file has been placed -->
<repositories>
<repository>
<id>Local</id>
<name>Repository Spark</name>
<url>/home/cristian/repository/sparkyspark/spark</url>
</repository>
</repositories>
<groupId>sparkjob</groupId>
<artifactId>sparkjob</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.test.skip>true</maven.test.skip>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>entry.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- bind to the packaging phase -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<configuration>
<rules><dependencyConvergence/></rules>
</configuration>
</plugin>
</plugins>
</build>
...
<dependencies>
....
....
here it is, the jar file I need
<!-- The last Spark jar file -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.4.5-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
...
....
</dependencies>
This is the error message, the path is correct...the file is there.
Ideas? :)
ERROR:
Could not resolve dependencies for project sparkjob:sparkjob:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.apache.spark:spark-core_2.11:jar:2.4.5-SNAPSHOT: Failed to read artifact descriptor for org.apache.spark:spark-core_2.11:jar:2.4.5-SNAPSHOT: Could not transfer artifact org.apache.spark:spark-core_2.11:pom:2.4.5-SNAPSHOT from/to Local (/home/cristian/repository/sparkyspark/spark): Cannot access /home/cristian/repository/sparkyspark/spark with type default using the available connector factories.....
UPDATE: hard wiring the path seems to be a good work-around...
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.4.5-SNAPSHOT</version>
<scope>system</scope>
<systemPath>/home/cristian/repository/sparkyspark/spark/spark-core_2.11-2.4.5-SNAPSHOT.jar</systemPath>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
If you want to use a folder as a repository you have to use file:// protocol.
So you repository config should be.
<repositories>
<repository>
<id>Local</id>
<name>Repository Spark</name>
<url>file:///home/cristian/repository/sparkyspark/spark</url>
</repository>
</repositories>

Need simple working pom.xml file for wsconsume

I am using Java8 and I am trying to consume webservice using jboss plugin.
I have tried https://docs.jboss.org/author/display/JBWS/wsconsume and ran into lot of compatibility issues
The problem is I am having lot of dependency error all the time and I am now fed up. The current error is Failure to find com.sun.istack:istack-commons-runtime:jar:1.1. My concern is do i need these many dependency to run simple wsconsume?
<pluginRepositories>
<pluginRepository>
<id>JBOSS</id>
<name>JBoss Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<version>6.1.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jboss.ws.plugins</groupId>
<artifactId>maven-jaxws-tools-plugin</artifactId>
<version>1.1.1.Final</version>
<executions>
<execution>
<id>My execution</id>
<goals>
<goal>wsconsume</goal>
</goals>
<configuration>
<wsdls>
<wsdl>mylocation?wsdl</wsdl>
</wsdls>
<targetPackage>src</targetPackage>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jboss.ws.native</groupId>
<artifactId>jbossws-native-client</artifactId>
<version>3.3.1.GA</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.2.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-spi</artifactId>
<version>3.1.4.Final</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
Resolved by executed the wsconsume.bat with exec-maven-plugin instead of CRAPY JBoss plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>runbatchfile</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${env.RH-SSO}/bin/wsconsume.bat</executable>
<arguments>
<argument>-o</argument>
<argument>${project.build.directory}\classes</argument>
<argument>C:\my.wsdl</argument>
</arguments>
</configuration>
</plugin>

nar-maven-plugin eclipse API Incompatibility

I'm using eclipse to compile/run my projects. I tried to use maven on c++ projects with nar-maven-plugin to build them. It works well as i launch maven goals in command line.
But when i import my maven project in eclipse, i have the following errors :
Execution default-nar-compile of goal
com.github.maven-nar:nar-maven-plugin:3.2.3:nar-compile failed: An API
incompatibility was encountered while executing
com.github.maven-nar:nar-maven-plugin:3.2.3:nar-compile:
java.lang.NoSuchMethodError:
org.codehaus.plexus.util.DirectoryScanner.setupMatchPatterns()V
----------------------------------------------------- realm = plugin>com.github.maven-nar:nar-maven-plugin:3.2.3 strategy =
org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
...
Moreover, eclipse seems to manage my project as a Java project instead of a C project.
Note : i'm using
Eclipse 4.3.1
M2E 1.4.0
CDT 8.3.0
My pom.xml
<project
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.sample</groupId>
<artifactId>helloworld-cplusplus-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>nar</packaging>
<name>Helloworld</name>
<properties>
<rootdir>${project.basedir}</rootdir>
<nar.linker>gpp</nar.linker>
<nar.arch>x86</nar.arch>
<nar.os>Windows</nar.os>
</properties>
<build>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<versionRange>[3.2.3,)</versionRange>
<goals>
<goal>nar-test-unpack</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<fork>true</fork>
<compilerVersion>1.8</compilerVersion>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.2.3</version>
<extensions>true</extensions>
<configuration>
<linker>
<name>g++</name>
</linker>
<libraries>
<library>
<type>executable</type>
</library>
</libraries>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sample</groupId>
<artifactId>helloworld-shared-library-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>nar</type>
</dependency>
</dependencies>
</project>
If someone is using nar-maven-plugin with eclipse can help me :). I would really like to use it on eclipse.
Thanks!

Maven doesn't execute any unit test

I am using Maven with multi-modules. There are 3 projects.
foo(the parent project)
foo-core
foo-bar
I configure all the dependencies and plugins in foo's pom:
<modules>
<module>../foo-core</module>
<module>../foo-bar</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
...
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.14.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
There are several base classes and util classes for unit test in foo-core, so I add the maven-jar-plugin in foo-core project to make it available to foo-bar:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
When I execute test goal, I got the result as follow:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
parallel='none', perCoreThreadCount=true, threadCount=2, useUnlimitedThreads=false
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
I do got tests in my projects. But why it doesn't run any of them?
Rename test files from **Tests.java to **Test.java or add the following configuration to pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
</configuration>
</plugin>
Additionally, one more cause for such a behaviour is if you have an exclusion for junit-vintage-engine in your pom.xml dependencies.
In my case I had excluded it from the spring-boot-starter-test dependency in my pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
This resulted in the same problem. Maven not able to recognize/find any test cases in the project even though they are present.
So just remove the exclusions section and run the maven command again.
Had similar issue was able to run unit test case by adding dependency to sunfire plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>2.22.0</version>
</dependency>
</dependencies>
</plugin>
above worked fine byb executing test cases on mvn install , mvn test and all
In my case, it was necessary to add the word "Test" to the end of the name of all files with tests.
For example, if you have "LoginTestNegative" then this will not work. You need to rename this to LoginNegativeTest. And now it will work.
I had a similar problem today. I had converted most of my tests to JUnit5 and surefire was not executing them via mvn test. I had to modify the pom.xml entry for surefire to force it to use the JUnit5 engine as it was selecting JUnit4 by default
Dependencies section (vintage is for the JUnit4 tests)
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
Plugin section
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M6</version>
<configuration>
<argLine>#{argLine}</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>3.0.0-M6</version>
</dependency>
</dependencies>
</plugin>

accessing a web service using axis and maven

Im trying to figure out how to access Web Services in Java using Axis.
As far as I understand, Here's what I need to do :
Use WSDL File + Axis tools to generate Java files.
Compile and package generated Java files and then consume those objects by using connection methods on these.
In trying to do this, here's where I'm stuck:
I picked a random Web Service from http://www.service-repository.com/
I used the axistools-maven-plugin in the following manner:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<configuration>
<urls>
<!--<url>http://soap.amazon.com/schemas2/AmazonWebServices.wsdl</url>-->
<!--<url>http://ws.xwebservices.com/XWebEmailValidation/V2/XWebEmailValidation.wsdl</url>-->
<url>http://mathertel.de/AJAXEngine/S02_AJAXCoreSamples/OrteLookup.asmx?WSDL</url>
</urls>
<!--<sourceDirectory>${project.build.sourceDirectory}/wsdl</sourceDirectory>-->
<packageSpace>com.company.wsdl</packageSpace>
<testCases>true</testCases>
<serverSide>true</serverSide>
<subPackageByFileName>true</subPackageByFileName>
<outputDirectory>${project.build.directory}/src/generated-sources</outputDirectory>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
Here's the issue:
I can successfully run mvn generate-sources and it does generate the Java files. But I can't seem to compile these Java files.
When I run mvn clean install it gives me a bunch of compile errors. What step am I missing ?
Based on your answer to one of my comment, my suggestion would be to use a JAX-WS implementation like JAX-WS RI - which is included in Java 6 - or Apache CXF (both are IMO much better WS stacks than the outdated Axis).
Here is an example based on JAX-WS RI and its jaxws-maven-plugin:
<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.stackoverflow</groupId>
<artifactId>Q3479139</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Q3479139</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven 2</name>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven2-repository.dev.java.net</id>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlUrls>
<wsdlUrl>http://ws.xwebservices.com/XWebEmailValidation/V2/XWebEmailValidation.wsdl</wsdlUrl>
</wsdlUrls>
<!-- The name of your generated source package -->
<packageName>com.example.myschema</packageName>
<!-- generate artifacts that run with JAX-WS 2.0 runtime -->
<target>2.0</target>
<!-- Specify where to place generated source files -->
<sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
</configuration>
</execution>
</executions>
<!-- if you want to use a specific version of JAX-WS, you can do so like this -->
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.2.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
And here is a very basic test case (part of the maven project) demonstrating the invocation of the web service using the generated classes:
package com.example.myschema;
import junit.framework.TestCase;
public class EmailValidationTest extends TestCase {
XWebEmailValidationInterface service = new EmailValidation().getEmailValidation();
ValidateEmailRequest request = new ValidateEmailRequest();
ValidateEmailResponse response = null;
public void testEmails() {
request.setEmail("foo#bar.com");
response = service.validateEmail(request);
assertEquals("EMAIL_SERVER_NOT_FOUND", response.getStatus());
request.setEmail("foo#gmail.com");
response = service.validateEmail(request);
assertEquals("NOT_VALID", response.getStatus());
}
}