zoukankan
html css js c++ java
delphi下使用http協議post方式發送xml數據到asp頁面和aspx頁面
delphi端的發送代碼
function Tverpipxinfo.postXml(
const
xmlstr, url: WideString): WideString;
var
idHttp:TIdHTTP;
sends:tstrings;
IdEncoderMIME1:TIdEncoderMIME;
begin
result:
=
''
;
try
idHttp:
=
TIdHTTP.Create(nil);
idHttp.Request.ContentType :
=
'
application/x-www-form-urlencoded
'
;
IdEncoderMIME1:
=
TIdEncoderMIME.Create(nil);
sends:
=
tstringlist.Create;
sends.Add(
'
xmlstr=
'
+
IdEncoderMIME1.Encode(xmlstr));
result:
=
idhttp.Post(url,sends);
except
on E:Exception
do
begin
result:
=
e.Message;
end;
end;
idHttp.Free;
IdEncoderMIME1.Free;
sends.Free;
end;
asp端接收方法
<
%@ Language
=
VBScript %
>
<
%
'
On Error Resume Next
xmlstr
=
Request.form(
"
xmlstr
"
)
set
xmlobj
=
server.
CreateObject
(
"
microsoft.xmldom
"
)
xmlobj.loadXML xmlstr
Response.ContentType
=
"
text/xml
"
%
>
<
?xml version
=
"
1.0
"
encoding
=
"
big5
"
?
>
<
%
Response.Write xmlobj.xml
set
xmlobj
=
nothing
%
>
aspx端接收方法
private
void
Page_Load(
object
sender, System.EventArgs e)
{
string
str
=
""
;
string
reqstr
=
""
;
try
{
XmlDocument doc
=
new
XmlDocument();
//
doc.Load(Request.InputStream);
reqstr
=
Request.Form[
"
xmlstr
"
];
reqstr
=
Encoding.GetEncoding(
"
big5
"
).GetString(Convert.FromBase64String(reqstr));
doc.LoadXml(reqstr);
doc.Save(
"
d:/test.xml
"
);
Response.Write(
"
How are you
..
"
);
}
catch
(Exception e1)
{
str
=
e1.Message;
}
Response.Write(
"
str ==
"
+
str);
}
查看全文
相关阅读:
Centos7运维(1)-为什么在centos7配置了静态IP不生效还是分配一个动态ip给我??
docker 常用命令
docker 安装
centos6.8 修改yum安装镜像源
开发自己的composer package
修改mysql密码
MySQL密码的恢复方法
nginx配置文件说明
天猫优惠券
mysql的一些心得
原文地址:https://www.cnblogs.com/oisiv/p/179633.html
最新文章
PBOCIC读芯片卡流程
windows下用C++获取本机IP地址
mysql的数据库备份与恢复
phpstudy的配置
LAMP之Nginx配置
查找nginx安装的路径以及相关安装操作命令
php链接mysql
织梦DEDECMS调用导航栏的顶级栏目、二级栏目及三级栏目
创建数据库表格
php头部中文标识
热门文章
Linux下apache日志分析与状态查看方法
Cenos7---linux下ssh/scp无密钥远程登陆其他服务器方法
Cenos7(4)---Samba服务器搭建
Cenos7--查看系统当前的状况,如cpu使用,内存占用,远程用户,负载情况,硬盘占用,网络带宽等统计信息
Centos7运维(2)-第一次在Linux下部署PHP项目,采用LAMP网站架构(Linux+Apache+MySQL+PHP)
CentOS7(3)---安装mysql数据库管理平台 phpmyadmin
常用的网络协议及其端口(ftp、telnet、smtp、http、pop3、dns、dhcp.......)
CentOS7---配置linux时间-系统时间与网络时钟同步问题.....
CentOS7---yum提示Another app is currently holding the yum lock; waiting for it to exit...
Cenos7 MySQL数据库ERROR 1044 (42000):Access denied for user ''@'localhost' to database 'mysql'的解决方法
Copyright © 2011-2022 走看看