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);
}
查看全文
相关阅读:
计算机网络通信
javap查看class文件
JDK动态代理与CGLib动态代理
error the @annotation pointcut expression is only supported at Java 5 compliance
redis清空缓存
利用HttpURLConnection发送请求
linux下用命令导出mysql表数据
adb push和pull使用
mysqld.exe占比cpu 100% 解决方案
养成好习惯
原文地址:https://www.cnblogs.com/oisiv/p/179633.html
最新文章
查询表中的所有列数据,去除指定列相同的数据
CURL 重要函数Curl_setopt参数详解
LibCurl编程流程
curl c/c++ api接口使用例程
2.2.2 小试牛刀--模拟实现Windows的UDP程序
2.1.2 小试牛刀--模拟实现Windows的TCP程序
1.3.1 数据报套接字编程
小试牛刀--编程实现获取计算机的IP地址和计算机名
1.2.2 开发准备
1.2.1 流式套接字编程
热门文章
1.1.4 小试牛刀--编程实现获取MAC地址(1)
linux操作系统基础篇(九)
linux操作系统基础篇(八)
linux操作系统基础篇(七)
linux操作系统基础篇(六)
linux操作系统基础篇(五)
linux操作系统基础篇(四)
linux操作系统基础篇(三)
linux操作系统基础篇(二)
linux操作系统基础篇(一)
Copyright © 2011-2022 走看看