http://www.cnblogs.com/ccqin/archive/2012/08/22/2650348.html

没测试过这个

var
Source: TMemoryStream;
Response: TStringStream ;
begin
try
// Set the properties for HTTP
idHTTP.Request.Username := 'www ';
idHTTP.Request.Password := 'www ';
// idHTTP1.Request.ProxyServer := '11.133.190.13 ';
// idHTTP1.Request.ProxyPort := StrToIntDef( '80 ', 80);
idHTTP.Request.ContentType := 'application/x-www-form-urlencoded ';
Response := TStringStream.Create( ' ');
try
Source := TMemoryStream.Create;
try
Source.LoadFromFile( 'unsub.xml '); //发送这个XML包,反向取消请求
idHTTP.Post( 'http://222.333.444.555/dsmp/dsmp.wsdl ', Source, Response);
finally
// Source.Free;
end; memo.Lines.Text := Response.DataString;//返回的字串,可以把它存为XML就可以
memo.Lines.SaveToFile( 'unsubresp.xml '); //返回的反向取消应答包
finally
Response.Free;
end;
finally
end

这个方法试了 可以用

以下仅供参考,要求在web页面写特殊的字符,根据返回的结果判断是否登陆成功,用户名,密码方式见下:

procedure   TForm1.Button1Click(Sender:   TObject);
var
Url: string;
Response : TStringStream;
Request : TStrings;
begin
Memo1.Clear;
Response := TStringStream.Create( ' ');
try
Request := TStringList.Create;
try
Request.Append( 'txtUserId=hengli&txtPassword=ysj);
url := 'http://192.168.1.33/nmmis/index.aspx ';
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded ';
IdHTTP1.Post(Url, Request, Response);
Memo1.Lines.Text := Response.DataString;
finally
FreeAndNil(Request);
end;
finally
FreeAndNil(Response);
end;
end;

通过idhttp上传文件到web上,然后返回上传的文件路径。

function   UpLoagFile(FileName:   String):   string;
var
obj : TIdMultiPartFormDataStream;
Url: String;
begin
obj := TIdMultiPartFormDataStream.Create;
try
obj.AddFile( 'Image ',FileName, GetMIMETypeFromFile(FileName));
http.Request.ContentType := obj.RequestContentType;
obj.Position := 0;
Url := 'http://192.168.1.44/insertImage.aspx ';
Result := http.Post(Url, obj);
finally
obj.Free;
end;
end; 服务端,C#:
private void Page_Load(object sender, System.EventArgs e)
{
foreach(string f in Request.Files.AllKeys)
{
string fileName, fullName;
HttpPostedFile postFile = Request.Files[f];
if (postFile.ContentLength > 10)
{
fileName = postFile.FileName;
//GetFileName( fileName, out fullName );
fullName = "UpLoad/aaa.jpg "
postFile.SaveAs ( Server.MapPath ( fullName ) );
Response.Write (fullName);
}
}
}

最新文章

  1. ddl dml dcl
  2. java 枚举类 enum 总结
  3. 使用paramikoHelper类实现MySQL安装和数据恢复
  4. 常用PDF文档开发库
  5. Android百度地图开发05之公交信息检索 + 路线规划
  6. c#配置文件appStrings配置节的读取、添加和修改
  7. Android的Fragment中onActivityResult不被调用的解决方案
  8. uboot移植前奏
  9. 在Delphi中隐藏程序进程
  10. Struts2中访问web元素的四种方式
  11. 17年年终总结——走过2017,迎来2018Flag
  12. EF Code First中的主外键约定和一对一、一对多关系的实现
  13. JavaScript DOM 高级程序设计读书笔记一
  14. HDU-6060 RXD and dividing
  15. python之进程和线程2
  16. kafka数据可靠传输
  17. C# sqlserver winform
  18. bioperl 格式化genebank的输出
  19. vue 中 命名视图的用法
  20. ERROR:org.apache.hadoop.hbase.PleaseHoldException: Master is initializing 解决方案

热门文章

  1. 老技术记录-C#+SqlServer使用SqlDependency监听数据库表变化
  2. Codeforces 833B 题解(DP+线段树)
  3. Codeforces - 1198C - Matching vs Independent Set - 贪心
  4. 搜索(DFS)---填充封闭区域
  5. 使用absolute实现的后台布局,包括小图标定位,菜单弹出等完整版
  6. latex中\large的作用域问题
  7. POJ 2104 区间第k大(主席树)
  8. vue2.0  之 directive指令 (自定义)
  9. javascrip的数组扁平化
  10. web前后端分离漏洞分析防御