post 发送xml
2016-02-14 23:32
274 查看
HttpPost httppost = new HttpPost(SERVICE_EPR); StringEntity se = new StringEntity(SOAPRequestXML,HTTP.UTF_8); se.setContentType("text/xml"); httppost.setHeader("Content-Type","application/soap+xml;charset=UTF-8"); httppost.setEntity(se); HttpClient httpclient = new DefaultHttpClient(); BasicHttpResponse httpResponse = (BasicHttpResponse) httpclient.execute(httppost);
添加list
public void postData() { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://10.10.4.35:53011/"); try { // Add your data List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new BasicNameValuePair("Content-Type", "application/soap+xml")); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Where/how to add the XML data? // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } }
相关文章推荐
- 小雷郑重承诺:在2017年之前,对大学毕业4年以来的所有努力和探索,做一个全面客观的总结,技术研究、工作创业、投资理财、朋友感情等
- 小雷郑重承诺:在2017年之前,对大学毕业4年以来的所有努力和探索,做一个全面客观的总结,技术研究、工作创业、投资理财、朋友感情等
- 【SPOJ-PRIME1】Prime Generator【区间质数筛】
- 自己实现下载框架(二)
- redis编译安装:make 的新错误--collect2: ld returned 1 exit status
- 小雷郑重承诺:在2017年之前,对大学毕业4年以来的所有努力和探索,做一个全面客观的总结,技术研究、工作创业、投资理财、朋友感情等
- 人员信息管理
- fastjson对Date的处理
- android 批量上传图片
- linux xargs详解
- Chapter1 基本Web应用程序
- VMWare下安装ubuntu64位出现错误“kernel requires an x86_64 cpu, but only detected ”
- 蓝桥杯——最小乘积(基本型)
- [Python]Threading.Thread之Daemon线程
- 【CodeForces 504A】Misha and Forest
- iPhone修改时间变砖
- iPhone修改时间变砖
- CSU 1556 Pseudoprime numbers
- 报错:Conversion to Dalvik format failed: Unable to execute dex:
- POJ 3252 Round Numbers(数位dp&记忆化搜索)