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);
}
查看全文
相关阅读:
Visio2019专业版激活方法
I2C总线协议
latch-up和Antenna-effect
读--数字集成电路物理设计
数字IC设计流程与工具
读--FPGA设计指导原则
读--数字集成电路设计与实现
FIFO
半导体存储器
触发器
原文地址:https://www.cnblogs.com/oisiv/p/179633.html
最新文章
记一次业务严重问题
dubbo管理控制台安装-dubbo(新版)
pip install pycrypto 出错解决办法
pytest之conftest
selenium进阶1
selenium入门学习二
selenium学习遇到的问题
电脑时间慢了10分钟
python中漂亮格式输出json
window.performance.timing.toJSON() 字段说明和主要性能指标
热门文章
Python(day8)迭代器、生成器
Python(day6)-函数
Python(day5)文件操作
Python(day4)集合、布尔类型
python_day3列表、元组、字典
python小练习
Python第一天
Python第二天
shell之流程控制
shell正则表达式(1 )
Copyright © 2011-2022 走看看