Amigos, o código estava funcionando antes de tentar inserir a anotação @SOAPBinding.
Eis o trace:
Exception in thread "main" com.sun.xml.internal.ws.spi.db.DatabindingException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.util.List é uma interface e JAXB não pode tratar interfaces.
this problem is related to the following location:
at java.util.List
at com.sun.xml.internal.ws.db.glassfish.JAXBRIContextFactory.newContext(Unknown Source)
at com.sun.xml.internal.ws.spi.db.BindingContextFactory.create(Unknown Source)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(Unknown Source)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(Unknown Source)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(Unknown Source)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingImpl.<init>(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(Unknown Source)
at com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel(Unknown Source)
at com.sun.xml.internal.ws.server.EndpointFactory.create(Unknown Source)
at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(Unknown Source)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(Unknown Source)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(Unknown Source)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(Unknown Source)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(Unknown Source)
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(Unknown Source)
at javax.xml.ws.Endpoint.publish(Unknown Source)
at br.com.caelum.estoque.ws.PublicaEstoqueWS.main(PublicaEstoqueWS.java:15)
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.util.List é uma interface e JAXB não pode tratar interfaces.
this problem is related to the following location:
at java.util.List
at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(Unknown Source)
at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(Unknown Source)
at com.sun.xml.internal.ws.developer.JAXBContextFactory$1.createJAXBContext(Unknown Source)
... 22 more
E o código:
@WebService
@SOAPBinding(style=Style.RPC)
public class EstoqueWS {
private ItemDao dao = new ItemDao();
@WebMethod(operationName="todosOsItens")
@WebResult(name="item")
@ResponseWrapper(localName="itens")
@RequestWrapper(localName="listaItens")
public List<Item>/*ListaItens*/ getItens(/*@WebParam(name="filtros") Filtros filtros*/){
System.out.println("Chamando getItens()");
//List<Filtro> lista = filtros.getLista();
//List<Item> itensResultado = dao.todosItens(lista);
//return new ListaItens(itensResultado); //criando uma ListaItens
return dao.todosItens();
}
@WebMethod(operationName="CadastrarItem")
@WebResult(name="item")
@RequestWrapper(localName="ItemParaCadastro")
@ResponseWrapper(localName="ItemCadastrado")
public Item cadastrarItem(
@WebParam(name="tokenUsuario", header=true) TokenUsuario token,
@WebParam(name="item") Item item) throws AutorizacaoException{
System.out.println("Cadastrando " + item + ", " + token);
boolean valido = new TokenDao().ehValido(token);
if (!valido) {
throw new AutorizacaoException("Token invalido");
}
new ItemValidador(item).validate();
this.dao.cadastrar(item);
return item;
}
}