Erro ao enviar um POST em RestFUL

Ola
Estou com dificuldade de fazer o meu WS ler um objeto (NotaFiscalVO nota) que estou enviando para ele.

Abaixo como estou enviando

private static final String URL_WS = “http://187.45.235.38:8080/WS/notaCliente/”;

    public String salvaNota(NotaFiscalVO nota) throws Exception {
                            Gson gson = new Gson();
                String notaJSON = gson.toJson(nota);
                String[] resposta = new WebServiceCliente().post(URL_WS + "salvaNota", notaJSON);
    	                if (resposta[0].equals("200")) {
	         return resposta[1];
	 } else {
	         throw new Exception(resposta[1]);
	 }
                  }
}

aqui como estou recebendo o dado no meu WS

       @Path("/notaCliente")
       public class NotaFiscalResorce {

               @POST
    @Path("/salvaNota")
    @Produces("application/json")
    @Consumes("application/json")
    public int inserirCliente(NotaFiscalVO nota) {
     return new NotaFiscalBusiness().insereNota(nota);
    }

      }


Esta me retornando
  "  The specified HTTP method is not allowed for the requested resource "

Podem me ajudar?

Obrigado.

Possíveis causas:

  1. Seu cliente de web service está errado.
  2. O endereço está errado (um recurso REST tem como caminho http[s]://<endereço>:<porta>/<contexto da aplicação>/<contexto do servlet JAX-RS>/<caminho>*

Por favor, poste o código do cliente (entre as tags ).

[]'s

Você também está cometendo um erro de modelagem, está usando a URI para modelar além de Recursos, Operações - SalvarNota.

Rest tem alguns preceitos, dentre eles Uniform Interface, logo você não precisa demonstrar na URI o que é salvar, o verbo POST é subentendido que você criaria uma nota fiscal.

O ideal na verdade seria trabalhar com conjuntos, como /notas/clientes/{idCliente} - o Verbo POST já expressa a operação.

Com relação à URI estar correta, antes de construir o Client Java, que tal testar no Browser com algum plugin como RestClient - https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

Ola

Abaixo a minha classe WebServiceCliente


public class WebServiceCliente {
	 public final String[] get(String url) {

	     String[] result = new String[2];
	     HttpGet httpget = new HttpGet(url);
	     HttpResponse response;
	     
	     Log.e("WebServiceCliente", url);
	     
	     try {
	         response = HttpClientSingleton.getHttpClientInstace().execute(httpget);
	         HttpEntity entity = response.getEntity();

	         if (entity != null) {
	             result[0] = String.valueOf(response.getStatusLine().getStatusCode());
	             InputStream instream = entity.getContent();
	             result[1] = toString(instream);
	             instream.close();
	             Log.i("get", "Result from post JsonPost : " + result[0] + " : " + result[1]);
	         }
	     } catch (Exception e) {
	         Log.e("NGVL", "Falha ao acessar Web service", e);
	         result[0] = "0";
	         result[1] = "Falha de rede!";
	     }
	     return result;
	    }

	    public final String[] post(String url, String json) {
	     String[] result = new String[2];
	     try {
	    	 
	         HttpPost httpPost = new HttpPost(new URI(url));
	         httpPost.setHeader("Content-type", "application/json");
	         StringEntity sEntity = new StringEntity(json, "UTF-8");
	         httpPost.setEntity(sEntity);

	         HttpResponse response;
	         response = HttpClientSingleton.getHttpClientInstace().execute(httpPost);
	         HttpEntity entity = response.getEntity();

	         if (entity != null) {
	             result[0] = String.valueOf(response.getStatusLine().getStatusCode());
	             InputStream instream = entity.getContent();
	             result[1] = toString(instream);
	             instream.close();
	             Log.d("post", "Result from post JsonPost : " + result[0] + " : " + result[1]);
	         }

	     } catch (Exception e) {
	         Log.e("NGVL", "Falha ao acessar Web service", e);
	         result[0] = "0";
	         result[1] = "Falha de rede!";
	     }
	     return result;
	    }

	    private String toString(InputStream is) throws IOException {

	     byte[] bytes = new byte[1024];
	     ByteArrayOutputStream baos = new ByteArrayOutputStream();
	     int lidos;
	     while ((lidos = is.read(bytes)) > 0) {
	         baos.write(bytes, 0, lidos);
	     }
	     return new String(baos.toByteArray());
	    }
	}