0
I have a problem in my webservice. It is giving this error:
Requestfailed Requestfailed --> Status: (405)
The code I’m using:
@DELETE
@Produces("text/plain")
@Path("ExcluirLista/{usuario}")
public boolean excluirTodos(@PathParam("usuario") String usuario)
{
ProdutoDAO dao = new ProdutoDAO();
return dao.excluir(usuario);
}
public boolean excluir(String usuario)
{
String sql = "delete * from listaproduto where uclogin=?";
Boolean retorno = false;
PreparedStatement pst = Conexao.getPreparedStatement(sql);
try {
pst.setString(1,usuario);
if(pst.executeUpdate()>0)
{
retorno = true;
}
} catch (SQLException ex) {
Logger.getLogger(ProdutoDAO.class.getName()).log(Level.SEVERE, null, ex);
retorno = false;
}
return retorno;
}
Even using the codes as you passed, it gave error 405, what I realized is that on top of my search in the test, it does not appear the url that will be used, but in the other get’s and post’s that I have shows...
– Renato Crispim
@Renatocrispim These codes will not change the HTTP status. The cause of this error is in the code that tries to call your method
excluirTodos
. This method is not even being invoked because it must be being called with the incorrect HTTP method.– Victor Stafusa
But why does this happen? Would you tell me? Because if I create a post or get it calls normally.
– Renato Crispim
@Renatocrispim Because the code that is trying to invoke your method is not using DELETE. Maybe it is using POST or GET.
– Victor Stafusa
I can’t fix it. What can I do?
– Renato Crispim
How are you doing to call the url?
– mari
@Renatocrispim Post the code you use to call your service. Without it you can not tell you how to fix.
– Victor Stafusa
Do you say code on another system that calls the webservice? I’m just testing it in netbeans... All about what’s giving problem is there... I’m just creating the delete and ta giving error, as I said if I create a post it works...
– Renato Crispim