String message ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"

      + "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
+ "<soap:Body>"
+ " <SetBxInfoTest xmlns=\"http://tempuri.org/\"> "
+ " <jkxlh>C33D61EF17</jkxlh> "
+ " <WriteXml> <![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ " <Data> "
+ " <value> "
+ " <Hphm/> "
+ " <Cjh>QWSDEFRTGVFEDSWER</Cjh> "
+ " <Bdh>63008080120150000001</Bdh> "
+ " <Pdh>23008135920150000001</Pdh> "
+ " <Jqxbf>1100.00</Jqxbf> "
+ " <Qbrq>2015-05-21</Qbrq> "
+ " <Zbrq>2016-05-20</Zbrq> "
+ " <Bbxr>张</Bbxr> "
+ " <Bbxrsfz>441225198006022516</Bbxrsfz> "
+ " <Jqxzt>1</Jqxzt> "
+ " <Scrq>2015-05-20 15:32:35</Scrq> "
+ " <Ccsqk>4</Ccsqk> "
+ " <Ccsje/> "
+ " <Ccspzhm/> "
+ " <Ccssbh/> "
+ " <Ccsnsrq/> "
+ " <Ccsnsqsrq/> "
+ " <Ccsnszzrq/> "
+ " <BdImg/> "
+ " </value> "
+ " </Data>]]> </WriteXml> "
+ " </SetBxInfoTest> "
+ " </soap:Body> "
+ "</soap:Envelope>";
HttpClient httpclient = HttpClients.createDefault();
HttpPost httppost = new HttpPost("http://10.15.22.120:8866/5700000002/ZHJDCBXSJAddCxSj/V1");//请求地址
StringEntity content =new StringEntity(message, Charset.forName("UTF-8"));// 第二个参数,设置后才会对,内容进行编码
content.setContentType("application/soap+xml; charset=UTF-8");//设置UTF-8编码
content.setContentEncoding("UTF-8");
httppost.setEntity(content); HttpResponse responses = null;
Document doc = null;
String queryResReceiveXml = null;
String sentity = null;
try {
responses = httpclient.execute(httppost);//执行发送
HttpEntity resEntity = responses.getEntity();
if (resEntity != null) {
sentity = EntityUtils.toString(resEntity, "UTF-8");//接受返回报文数据
System.out.println("返回2报文:"+sentity);
doc = XmlTool.getDocument(sentity, "UTF-8");//转换格式化
Element eRoot = doc.getRootElement();
Element body = eRoot.getChild("Body", eRoot.getNamespace());
Element resp = (Element) body.getChildren().get(0);
Element returnele = (Element) resp.getChildren().get(0);
if(returnele != null){
queryResReceiveXml = returnele.getText().toString();
}
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
System.out.println("返回报文:\n" + queryResReceiveXml);
}

最新文章

  1. JavaScript图表FusionCharts免费在线公开课,由印度原厂技术工程师主讲,10月13日发车
  2. Android Weekly Notes Issue #232
  3. c#在字符串中计算加减乘除...
  4. 如何用iframe标签以及Javascript制作时钟?
  5. HDU 1850 (Nim博弈 取胜方案数) Being a Good Boy in Spring Festival
  6. c#局域网文件搬移
  7. vmware下linux 如何添加硬盘
  8. jquery的.detach()方法
  9. 【转】使用adb命令对手机进行截屏(截图)保存到电脑,SDCard
  10. Spring的注解学习(ioc,aop结合)
  11. Oracle分析函数之开窗子句-即WINDOWING子句
  12. RAC时间同步的两种方法
  13. as3 操作图片,获取,设置实际像素,扣除透明区域
  14. 如何使用IntelliJ IDEA的Favorites来管理项目中的常用代码
  15. HTML5须知十件事
  16. KVO and Swift
  17. QT Designer基础——登录界面设计基础版2
  18. codeforces701C
  19. MyISAM和InnoDB区别 及选择
  20. flask框架詳解

热门文章

  1. Git源码管理工具使用
  2. [LOJ3014][JOI 2019 Final]独特的城市——树的直径+长链剖分
  3. cmd 常用命令
  4. 机器学习---感知机(Machine Learning Perceptron)
  5. Spark-1(概念)
  6. (转) qt: usb热插拔(linux);
  7. 小程序 input type number 键盘没有小数点
  8. Qt快速入门第三版下载
  9. XXX系统项目分析
  10. 视频显著性检测-----Predicting Video Saliency using Object-to-Motion CNN and Two-layer Convolutional LSTM