Необходимо указать полное имя для интерфейса конечной точки.Попробуйте это, если хотите потерять интерфейс конечной точки.
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
import java.util.Date;
interface IService {
void hello(String username);
}
@WebService(targetNamespace = "ServiceImpl")
class ServiceImp implements IService{
public void hello(@WebParam(name = "username") String username) {
System.out.println("hello " + username + " now is " + new Date());
}
}
public class ServiceMain {
public static void main(String[] args) {
String address = "http://localhost:7777/myService";
Endpoint.publish(address, new ServiceImp());
System.out.println("OK");
}
}
В противном случае, если ваш интерфейс конечной точки находится в пакете с именем your.pkg, попробуйте это.
package your.pkg;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
import java.util.Date;
@WebService
interface IService {
void hello(String username);
}
@WebService(targetNamespace = "ServiceImpl", endpointInterface="your.pkg.IService")
class ServiceImp implements IService{
public void hello(@WebParam(name = "username") String username) {
System.out.println("hello " + username + " now is " + new Date());
}
}
public class ServiceMain {
public static void main(String[] args) {
String address = "http://localhost:7777/myService";
Endpoint.publish(address, new ServiceImp());
System.out.println("OK");
}
}
Я смогзапустите его с обоими подходами и начните получать WSDL с конечной точки: - http://localhost:7777/myService?wsdl