http://localhost:8080/myservice?wsdl
App.java
package com.training;
import javax.xml.ws.Endpoint;
public class App {
public static void main(String[] args) {
SimpleWsServiceImpl simpleWsServiceImpl = new SimpleWsServiceImpl();
String address = "http://localhost:8080/myservice";
Endpoint.publish(address, simpleWsServiceImpl);
System.out.println("WSDL address: " + address + "?wsdl");
}
}
SimpleWsServiceImpl.java
package com.training;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService
public class SimpleWsServiceImpl {
public String getServiceName() {
return "SimpleWsServiceImpl";
}
public String hello(@WebParam(name = "nameParam") 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.training</groupId>
<artifactId>jax_ws_jse_endpoint_publish</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>