[Duvida] Como testar meu WebService? Através do WSDL?

Fala galera beleza? estou tentando fazer meu primeiro WebService utilizando Eclipse + JBoss 5.0

Ele chega a subir e gera um endereço WSDL.

Quero através deste ou de alguma outra forma chamar meu método remoto em um Client.

Estou achando diversas formas porem nenhuma se encaixa no que eu realmente eu quero.

Estou utilizando JBoss e somente acho tutoriais explicando o Funcionamento do TomCat + AXIS

Acho que no JBoss não há essa necessidade, Alguém sabe alguma forma de eu chamar meu método?

Abraço e muito obrigado desde já.

Meu WebService


package com.test.dhanago;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;


@WebService(name = "TestWs")
@SOAPBinding(
		
				style = SOAPBinding.Style.DOCUMENT,
				use   = SOAPBinding.Use.LITERAL,
				parameterStyle = SOAPBinding.ParameterStyle.WRAPPED
				
		
			)
			

public class TestWs {
	
	@WebMethod
	public String greet(@WebParam (name = "name") String name ){
		
		return "Hello " + name;
		
	}

}

Meu Client:

^^^




public class Index {
	
	public static void main(String[] args) {
		
		String local = "http://127.0.0.1:8080/TutWS/TestWs?wsdl";
	}

}

EDIT ---------------------------
Tentei Fazer o seguinte no meu client:

[code]import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;

import com.test.dhanago.TestWs;

public class Index {

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)

Gabriel,

O jeito que eu sempre testo meus Web Services é usando o SoapUI, você só passa a url do wsdl que ele gera um cliente, tudo automático.

http://www.soapui.org/

É free :slight_smile:

boa tarde a todos…

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?

obrigado

Acredito que esse artigo vai ajudar vcs.

http://www.linhadecodigo.com.br/ArtigoImpressao.aspx?id=1286

:smiley:

Eu testo meus web services através de clients gerados com tasks do Ant.
Para isto, também utilizo a api apache axis.

Aí só instancio o locator, recupero a partir dele o objeto da classe soap e chamo a operação do meu web service desse objeto.

vejam se isso ajuda
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.wst.command.env.doc.user/topics/twbwsclienta.html

http://www.teses.usp.br/teses/disponiveis/55/55134/tde-24072012-164751/pt-br.php