-1

After migrating restfull application from one machine another machine we are able to acess only GET type methods but we are unable to access POST type methods. I am using Tomcat 6.0.36.Please help on this. Please find the code which I am using.

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

import org.jboss.resteasy.annotations.ResponseObject;
import org.json.JSONObject;

import com.Clients.MobileAPIClient;

@Path("/MobileAppFNOLAPI")
public class MobileAppFNOLAPI {


@GET
@Path("/getClaims")
public JSONObject getClaims(
    @QueryParam("input") String input) {

    String getClaims = null;

    JSONObject jsonObject = null;

    System.out.println("inside getClaims()"+input);

    MobileAPIClient mobileAPIClient = new MobileAPIClient();
    try {

        getClaims = mobileAPIClient.callPersonalAPI().getClaims(input);

        System.out.println(getClaims);

        jsonObject = new JSONObject(getClaims);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return jsonObject;

}


@GET
@Path("/getClaimStatus")
public JSONObject getClaimStatus(
    @QueryParam("input") String input) {

    System.out.println("inside getClaimStatus()"+input);

    String claimStatus = null;

    JSONObject jsonObject = null;

    // Write the business Logic and return the output finally

    MobileAPIClient mobileAPIClient = new MobileAPIClient();
    try {
        claimStatus = mobileAPIClient.callPersonalAPI().getClaimStatus(input);
        jsonObject = new JSONObject(claimStatus);
        System.out.println(claimStatus);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }


    return jsonObject;

}


@POST
@Path("/savePortalClaim/{xmlInput}")

        public JSONObject savePortalClaim (@PathParam("xmlInput") String xmlInput) {
    String saveClaimStatus = null;
    JSONObject jsonObject = null;
    System.out.println("inside savePortalClaim() "+xmlInput);

    MobileAPIClient mobileAPIClient = new MobileAPIClient();
    try {
         saveClaimStatus = mobileAPIClient.callPersonalAPI().savePortalClaim(xmlInput);
         jsonObject = new JSONObject(saveClaimStatus);
         System.out.println(saveClaimStatus);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    // Write the business Logic and return the output finally
    return jsonObject;
}
@GET
@Path("/doesPolicyExists")
public JSONObject doesPolicyExists(@QueryParam("policyNumber") String policyNumber,@QueryParam("password") String password) {

System.out.println("inside doesPolicyExists()"+policyNumber);
System.out.println("inside doesPolicyExists()"+password);

//String policyNumber = null
JSONObject jsonObject = null;

// Write the business Logic and return the output finally

MobileAPIClient mobileAPIClient = new MobileAPIClient();
try {
    System.out.println("startinggggggggggggggggggggggggggggggggggggggggg");
   String  policyResult = mobileAPIClient.callPersonalAPI().doesPolicyExists(policyNumber, password);
    System.out.println("policyResult--------------------------->"+policyResult); 
    jsonObject = new JSONObject(policyResult);

} catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}


return jsonObject;

}}
sschrass
  • 7,014
  • 6
  • 43
  • 62
Sam
  • 1
  • 1
  • 1
    Please provide more information. What implementation of `REST` you are using, what is your machine, what is the code and all other relevent information – Vivek Vardhan May 08 '15 at 06:28
  • Thanks for responding. I have posted the code. And I am using window 7 machine. – Sam May 08 '15 at 06:44

1 Answers1

0
  • It could be that, on one machine you have got HTTP VERB POST enabled but not on the machine that is not working.

  • Worth checking the TOMCAT web server configuration between the machines.

ragingasiancoder
  • 616
  • 6
  • 17
Ranganatha
  • 1,157
  • 14
  • 32
  • in web.xml I have used following code           Ressources REST       /*         OPTIONS         PUT         POST         TRACE                     *          – Sam May 08 '15 at 09:02