ws

JAX-WS generate wsdl from maven

SimpleWsService.java pom.xml

http://localhost:9080/jax_ws_generate_wsdl_from_maven/SimpleWsServiceService?wsdl

http://localhost:9080/jax_ws_generate_wsdl_from_maven/SimpleWsServiceService.wsdl

http://localhost:9080/jax_ws_generate_wsdl_from_maven/SimpleWsServiceService_schema1.xsd

SimpleWsService.java

package com.training.ws;

import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;

@Stateless
@WebService
public class SimpleWsService {

    @WebMethod
    public String getServiceName() {
        return "SimpleWsService";
    }

    @WebMethod
    public String hello(String name) {
        return "Hello: " + name;
    }

}

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.training.rs</groupId>
    <artifactId>jax_ws_generate_wsdl_from_maven</artifactId>
    <packaging>war</packaging>
    <version>1.0</version>

    <build>
        <plugins>

            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jvnet.jax-ws-commons</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>wsgen</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sei>com.training.ws.SimpleWsService</sei>
                    <genWsdl>true</genWsdl>
                    <keep>true</keep>
                    <resourceDestDir>${basedir}/src/main/webapp</resourceDestDir>
                    <sourceDestDir>${basedir}/src/main/java</sourceDestDir>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

</project>