在这里,我想post idea从. 为此,我没有确切的想法,但到目前为止我已经尝试过。drupalandroid
我尝试了帖子title和body。我正在将标题和正文转换为json格式并传递给服务器。我尝试发布individual title and body  或combine title & body  
添加个人标题和正文时:
 List<NameValuePair> params = new ArrayList<NameValuePair>();
          params.add(new BasicNameValuePair("type","page"));
          params.add(new BasicNameValuePair("title",title));
          params.add(new BasicNameValuePair("body",jsonnode.toString()));
                         // jsonnode value is {"und":[{"value":"body value"}]}
         System.out.println("value of the params =============> "+params);
给我吗status code 401
I/System.out(  524): @@@@@@2    jsonnode=======>{"und":[{"value":"body value"}]}
I/System.out(  524): value of the combine node=======>{"type":"article","body":{"und":[{"value":"body value"}]},"title":"title"}
I/System.out(  524): value of the params =============> [type=page, title=title, body={"und":[{"value":"body value"}]}]
W/DefaultRequestDirector(  524): Authentication error: Unable to respond to any of these challenges: {}
I/System.out(  524): =========> statusCode post idea=====> 401
结合标题和正文:
 List<NameValuePair> params = new ArrayList<NameValuePair>();
          params.add(new BasicNameValuePair("node",json.toString()));   
                        //  json value is  {"type":"article","body":{"und":[{"value":"body"}]},"title":"title"}
            System.out.println("value of the params =============> "+params);
给我吗status code 406
I/System.out(  571): @@@@@@2    jsonnode=======>{"und":[{"value":"body"}]}
I/System.out(  571): value of the combine node=======>{"type":"article","body":{"und":[{"value":"body"}]},"title":"title"}
I/System.out(  571): value of the params =============> [node={"type":"article","body":{"und":[{"value":"body"}]},"title":"title"}]
I/System.out(  571): =========> statusCode post idea=====> 406
连接:
public static String makeWebForPostIdea(String url, String title,String body)
    {
        JSONStringer jsonobject = null;
        JSONObject json = null;
        JSONObject jsonnode = null;
        DefaultHttpClient client = new DefaultHttpClient();
        HttpPost post = new HttpPost(url);
        try {
            JSONObject jsonvalue = new JSONObject();
            jsonvalue.put("value", body.toString());
            JSONArray array = new JSONArray();
            array.put(jsonvalue);
            jsonnode = new JSONObject();
            jsonnode.put("und", array);
            System.out.println("@@@@@@2    jsonnode=======>"+jsonnode.toString());
        } catch (JSONException e3) {
            // TODO Auto-generated catch block
            e3.printStackTrace();
        }
        try {
               //jsonobject = new JSONStringer().object().key("und").array().object().key("value").value(body).endObject().endArray().endObject();
               json = new JSONObject();
               json.put("title",title);
               json.put("body", jsonnode);
               json.put("type","article");
            System.out.println("value of the combine node=======>"+json.toString());   
            //System.out.println("=============>"+jsonobject);
        } catch (JSONException e2) {
            // TODO Auto-generated catch block
            e2.printStackTrace();
        }
         List<NameValuePair> params = new ArrayList<NameValuePair>();
          params.add(new BasicNameValuePair("node",json.toString()));
           // params.add(new BasicNameValuePair("type","page"));
            //params.add(new BasicNameValuePair("title",title));
            //params.add(new BasicNameValuePair("body",jsonnode.toString()));
            System.out.println("value of the params =============> "+params);
        UrlEncodedFormEntity formEntity = null;
        try {
                formEntity = new UrlEncodedFormEntity(params);
        } catch (UnsupportedEncodingException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        post.setEntity(formEntity);
        try {
            HttpResponse response = client.execute(post);
            int statusCode = response.getStatusLine().getStatusCode();
            System.out.println("=========> statusCode post idea=====> "+statusCode);    
            if (statusCode == HttpStatus.SC_OK)
            {
                HttpEntity entity = response.getEntity();
                InputStream is = entity.getContent();
                return iStream_to_String(is);
            }
            else
            {
                return "Hello This is status ==> :"+String.valueOf(statusCode);
            }
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
     public static String iStream_to_String(InputStream is1) {
            BufferedReader rd = new BufferedReader(new InputStreamReader(is1), 4096);
            String line;
            StringBuilder sb = new StringBuilder();
            try {
                while ((line = rd.readLine()) != null) {
                    sb.append(line);
                }
                rd.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
            e.printStackTrace();
        }
        String contentOfMyInputStream = sb.toString();
        return contentOfMyInputStream;
    }
}