首页 技术 正文
技术 2022年11月19日
0 收藏 922 点赞 3,115 浏览 2063 个字
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);
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,985
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,501
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,345
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,128
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,763
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,839