2011-09-24 60 views

回答

2

如果你需要一個代碼示例:

String response = null; 

    httppost = new HttpPost(URL_STRING); 
    httppost.setParams(httpParams); 

    String s = your_XML_Data_As_String_Or_JSON_Or_Whatever; 

    try { 

     StringEntity entity = new StringEntity(s); 
     httppost.setEntity(entity); 
     httppost.addHeader("Content-Type", "SomeMIMEType"); 

     response = httpclient.execute(httppost, handler); 
     } catch (Exception e){ 
      e.printStackTrace }