POST方法不起作用

时间:2014-02-02 15:14:33

标签: java android oracle11g oracle-apex

我正在开发一个通过RESTful服务访问云中的Oracle数据库的Android应用程序,Oracle APEX提供了用于创建REST服务的界面。在客户端,我能够通过JAVA HttpClient API和响应调用GET请求JSON格式就好了。问题是当调用POST请求时我没有得到相应的响应。我按照文档的指示做了一切, (还定义了出站参数) 请看看这张图片广告告诉我我做错了什么 http://i58.tinypic.com/2gt5bb5.png

客户端的代码是这样的:

HttpPost post = new HttpPost(url);
JSONObject json = new JSONObject();
json.put("MNUM", "234564");
StringEntity se = new StringEntity( json.toString());
post.setEntity(se);
HttpResponse response = httpClient.execute(post);
HttpEntity entity = response.getEntity();
text = getASCIIContentFromEntity(entity); // this function converts response to string

源中的PL / SQL是:

DECLARE
id USER_INFO.m_number%type; //user_info is a table and m_number is its primary key (which i am trying to post from my app)
BEGIN
INSERT into USER_INFO(m_number)
values(:MNUM)
returning m_number into id;
:status := 201;
:location := id;
commit;
END;

任何人都可以告诉我为什么我无法在这之后发帖,任何帮助将不胜感激,我几天都被困在这一部分。 我收到的错误是服务不可用。

1 个答案:

答案 0 :(得分:0)

使用Postman应用程序(chrome webstore)测试您的API调用,看看它们是否有效。如果这不能帮助您解决粘贴输入和输出的问题。