public static void main(String[] args) {
String local = "http://127.0.0.1:8080/TutWS/TestWs?wsdl";
URL url = null;
try {
url = new URL(local);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//Nome qualifcado do serviço
//Primeiro argumento é o URI do serviço
//Segundo é o nome do serviço publicado no WSDL
QName qname = new QName("http://dhanago.test.com/", "TestWsService");
//Cria, de fato, uma fábrica para o serviço
Service service = Service.create(url, qname);
//Extrai a interface endpoint, o serviço ?port?.
TestWs ws = service.getPort(TestWs.class);
System.out.println(ws.greet("Gabriel"));
}
}
[/code]
Referênciando o Projeto Web.
Mais não funcionou,
Abaixo o que foi gerado:
Exception in thread "main" com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.test.dhanago.jaxws.Greet is not found. Have you run APT to generate them?
at com.sun.xml.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:287)
at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:596)
at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:543)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:371)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:258)
at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:633)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:328)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:311)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:339)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:343)
at javax.xml.ws.Service.getPort(Unknown Source)
at Index.main(Index.java:30)
tb estou com o mesmo problema acima. Daqui do serviço a url do aplicativo (http://www.soapui.org/) é bloqueada, alguem tem alguma observação a mais sobre o assunto?