4

I am requesting for put operation and after request performed I am redirecting to GET service URL.Here, I am facing the issue of 405 HTTP error code. However, same code works for me in the case of POST operation.

Below code is EndPoint:

@PUT
@Produces({ MediaType.APPLICATION_JSON })
public Response put(InputStream objInputStream) {
    // System.out.println("AckService.put()");

    String strOutput = "";
    Status objStatus = Status.OK;
    URI objRedirectionURI = null;

    try {
            this.submitRequest(objInputStream);
            objRedirectionURI = new URI("https://local.test.com:8443/Reply/fetch");
            System.err.println("\n\nredirecting the put request...... to get operation\n\n");
            return Response.seeOther(objRedirectionURI).build();

    } catch (Exception e) {
        e.printStackTrace();
        objStatus = Status.INTERNAL_SERVER_ERROR;
    }


}

Client:

ClientResponse response = null;   
 try {
    response = objWebResource.accept(MediaType.APPLICATION_JSON)
                    .type(MediaType.APPLICATION_JSON)
                    .put(ClientResponse.class, strInputData);

}catch (Exception e) {
    blnIsOk = false;
if(null != e.getMessage())
    lstExceptionMessage.add(e.getMessage());
e.printStackTrace();

}

Please let me know how I can resolve this.

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
krutik
  • 119
  • 4

1 Answers1

0

In that question I think you can find the answer: PUT-POST Rest Information

Community
  • 1
  • 1
Gergely A.
  • 404
  • 3
  • 6