Mudanças entre as edições de "Criando aplicação JAX WS com geração automática de WSDL"

De Basef
Ir para: navegação, pesquisa
 
Linha 1: Linha 1:
 
Segue abaixo exemplo de endpoint SOAP, cuja geração do WSDL é automática:
 
Segue abaixo exemplo de endpoint SOAP, cuja geração do WSDL é automática:
 
  
 
<source lang="java">
 
<source lang="java">
Linha 9: Linha 8:
 
public class App {
 
public class App {
 
     public static void main(String[] args) {
 
     public static void main(String[] args) {
         InvestimentoService service = new InvestimentoService();
+
         HelloService service = new HelloService();
         String url = "http://localhost:8080/investimentows";
+
         String url = "http://localhost:8080/hellows";
  
 
         System.out.println("Serviço rodando " + url);
 
         System.out.println("Serviço rodando " + url);
Linha 19: Linha 18:
  
 
@WebService
 
@WebService
public class InvestimentoService {
+
public class HelloService {
  
 
     public String helloWorld() {
 
     public String helloWorld() {
Linha 27: Linha 26:
  
 
</source>
 
</source>
 +
 +
Ao rodar o programa, o WSDL pode ser acessado via http://localhost:8080/hellows?wsdl.
  
 
[[Category:Java]]
 
[[Category:Java]]

Edição atual tal como às 10h23min de 26 de junho de 2017

Segue abaixo exemplo de endpoint SOAP, cuja geração do WSDL é automática:

import javax.xml.ws.Endpoint;
import javax.jws.WebService;
 
public class App {
    public static void main(String[] args) {
        HelloService service = new HelloService();
        String url = "http://localhost:8080/hellows";
 
        System.out.println("Serviço rodando " + url);
 
        Endpoint.publish(url, service);
    }
}
 
@WebService
public class HelloService {
 
    public String helloWorld() {
        return "Teste";
    }
}

Ao rodar o programa, o WSDL pode ser acessado via http://localhost:8080/hellows?wsdl.