Несмотря на то, что я определил endpointInterface для реализации интерфейса конечной точки службы (SEI), я получаю ошибку getport
Исключение в потоке "main" javax.xml.ws.WebServiceException: неопределенный тип порта: {http://soaptestclient.example.com/}iSoapEndPoint
Следующие вопросы и ответы, относящиеся к той же проблеме, не помогли мне решить ее
Java WebServiceException: неопределенный тип порта с JBoss
javax.xml.ws.WebServiceException: неопределенный тип порта Java Struts SOAP WSDL
Интерфейс конечной точки службы равен
package com.example.soaptest1;
...
@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface iSoapEndPoint {
@WebMethod String getHelloWorldAsString(String name);
}
Реализация интерфейса конечной точки службы
package com.example.soaptest1;
...
@WebService(endpointInterface = "com.example.soaptest1.iSoapEndPoint")
public class SoapEndPointImpl implements iSoapEndPoint{
@Override
public String getHelloWorldAsString(String name) {
return "Hello World JAX-WS " + name;
}
}
Издатель конечной точки службы
public class SoapEndPointPublisher {
public static void main(String[] args){
Endpoint.publish("http://192.168.1.11:9999/ws/hello", new SoapEndPointImpl());
}
}
и, наконец, клиент
public class SoapClient {
public static void main (String [] args) throws Exception{
URL url = new URL("http://192.168.1.11:9999/ws/hello?wsdl");
QName qname = new QName("http://soaptest1.example.com/", "SoapEndPointImplService");
Service service = Service.create(url,qname);
if one has enough experience in "reading" wsdl
iSoapEndPoint soapEndPointInterface = service.getPort(iSoapEndPoint.class);
//The interface iSoapEndPoint was copied from the EndPoint
//Java project to the client Java project so that I can import it since I'm not using wsimport
System.out.println(soapEndPointInterface.getHelloWorldAsString("Hello"));
}
}