Olá, estou com uma dúvida meio besta, mas vamos lá: como faço para criar um web service em java? Alguém poderia dar um exemplo bem básico?
Um abraço, muito obrigado. 
Olá, estou com uma dúvida meio besta, mas vamos lá: como faço para criar um web service em java? Alguém poderia dar um exemplo bem básico?
Um abraço, muito obrigado. 
http://guj.com.br/article.show.logic?id=159
http://faq.javaranch.com/java/WebServicesFaq (mais recomendado, utiliza Axis2)
Com o eclipse ganimedi é fácil, é só criar uma classe java clicar com o direito e selecionar WebServices em seguida Create WebServices. Dai é só seguir o wizard.
http://guj.com.br/article.show.logic?id=159http://faq.javaranch.com/java/WebServicesFaq (mais recomendado, utiliza Axis2)
Segui os passos do primeiro link, e está ocorrendo o erro
HTTP Status 404 - /axis
type Status report
message /axis
description The requested resource (/axis) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.26
Faltou ‘startar’ alguma coisa?
Jersey 8)
Depende do que quer fazer, em web services há dois tipos de implementação SOAP ou REST, abaixo posto um exemplo de codigo do jersey.
<a class="mention" href="/u/path">@Path</a>(“Ws”)
@Produces(“application/xml”)
@Provider
public class Ws {
<a class="mention" href="/u/get">@GET</a>
<a class="mention" href="/u/path">@Path</a>(“caminho”)
public List buscarObjetosPorParametros(
@QueryParam(“obj”) @DefaultValue("") String obj,
@QueryParam(“obj”) @DefaultValue("") String obj,
@QueryParam(“obj”) @DefaultValue("") String obj,
@QueryParam(“obj”) @DefaultValue("") String obj,
@QueryParam(“obj”) @DefaultValue("") String obj)
throws Exception {
List objetos= null;
try {
} catch (Exception ex) {
throw new WebApplicationException(ex,
Response.Status.INTERNAL_SERVER_ERROR);
}
return objetos;
}
}
ASS: A VOZ DO INFERNO.
Depende do que quer fazer, em web services há dois tipos de implementação SOAP ou REST, abaixo posto um exemplo de codigo do jersey.
<a class="mention" href="/u/path">@Path</a>(“Ws”)
@Produces(“application/xml”)
@Provider
public class Ws {
<a class="mention" href="/u/get">@GET</a>
<a class="mention" href="/u/path">@Path</a>(“caminho”)
public List buscarObjetosPorParametros(
@QueryParam(“obj”) @DefaultValue("") String obj,
@QueryParam(“obj”) @DefaultValue("") String obj,
@QueryParam(“obj”) @DefaultValue("") String obj,
@QueryParam(“obj”) @DefaultValue("") String obj,
@QueryParam(“obj”) @DefaultValue("") String obj)
throws Exception {
List objetos= null;
try {
} catch (Exception ex) {
throw new WebApplicationException(ex,
Response.Status.INTERNAL_SERVER_ERROR);
}
return objetos;
}
}
ASS: A VOZ DO INFERNO.