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);
}
查看全文
相关阅读:
机器学习面试
网易有道2017内推编程题2道
老曹眼中的网络编程基础
MySQL索引背后的数据结构及算法原理
[oracle] oracle-ibatis-整理
[oracle] oracle-myibatis-整理
[mysql] mysql-myibatis-整理
[JS] selector 背景选择器
[android] AndroidManifest.xml 详解
[Eclipse] 项目编码
原文地址:https://www.cnblogs.com/oisiv/p/179633.html
最新文章
了解CSS/CSS3原生变量var
Apache和Nginx的区别
一种table超出高度自动出滚动条的解决方案
Web Components的概念和用法
决胜未来,2019年前端开发十大战略性技术布局
前端数据Mock
插件之下拉框Select2
mysql查询各种类型的前N条记录
linux通过shell脚本修改文件内容
页面回到顶部
热门文章
Java去除所有非中文字符串
MongoDB基本用法
thinkPHP隐藏url地址栏中的index.php方法
ActiveMQ搭建
ssh证书登录(实例详解)
机器学习知识体系(强烈推荐)
C++继承与派生详解:C++派生类声明和构成、继承的意义
《C++ Primer》第II部分:C++标准库
关于直播,所有的技术细节都在这里了(三)
【调试】Linux下超强内存检测工具Valgrind
Copyright © 2011-2022 走看看