1

我正在为大学开发一个软件项目,我们必须将客户端实现到 Android 上的特定 REST 服务。REST-Post 接受两个参数:

  • 文档(一个 XML 文档,在我的代码中作为从“TriageTag”对象创建的 org.w3c.dom.Document 存在)
  • 时间戳(一个字符串,代表客户端的 POST 时间)

到目前为止我所拥有的:

            [... timestamp / post url preparations etc. ...]

            //Generate String from XML
            InputSource is = new InputSource(c.getResources().openRawResource(R.raw.cda_template));
            Document doc = CDAParser.TriageTagObjectToXml(tag, is);

            //Data
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>

            //FILL IN: SET DOC AS PARAM. WHO DO I DO THIS!?!?

            nameValuePairs.add(new BasicNameValuePair("timestamp", timestamp));
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            // Execute HTTP Post Request
            HttpResponse response = client.execute(httppost);
            StatusLine status = response.getStatusLine();

            [... check status etc. ... ]
4

0 回答 0