从一台机器迁移restfull应用程序后,我们只能访问GET类型的方法,但是我们无法访问POST类型方法。我正在使用Tomcat 6.0.36。请帮忙。 请找到我正在使用的代码。
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;
}}
答案 0 :(得分:0)
可能是,在一台计算机上启用了HTTP VERB POST但在没有工作的计算机上没有启用。
值得检查机器之间的TOMCAT Web服务器配置。