http 调用soap webservice
来源:互联网 发布:sqlite for mac 编辑:程序博客网 时间:2024/06/05 17:39
delphi
使用控件idhttp,post xml字符串,获取返回结果
有用记得回复一下,满足我小小的虚荣心
//下面是是调用AAA的接口,返回的也是xml字符串
//这个调了一整天,网上没找到完整的资料,一些属性猜了又猜,还用抓包工具不断调,才搞定,程序员有时也要踩狗屎才行啊
很多人都习惯用httprio控件,不过我用的是delphi7, 然后这个控件就不稳定了,要到Delphi2010后的版本才能稳定使用
不然一些启用了数据保护的电脑就会报内存错误,(右键 我的电脑 => 属性 => 高级 选项卡 在性能那点设置 => 数据执行保护 ),要禁用数据保护才能跑.
delphi
<span style="font-family:Microsoft YaHei;font-size:14px;">var IdHTTP1: TIdHTTP; Params: TStrings; html: string;begin IdHTTP1 := TidHTTp.create(self); Params := TStringList.Create; IdHTTP1.AllowCookies := True; IdHTTP1.HTTPOptions := [hoKeepOrigProtocol]; IdHTTP1.ProtocolVersion := pv1_1; IdHTTP1.Request.Accept := '*/*'; IdHTTP1.Request.ContentType := 'text/xml; charset=utf-8'; IdHTTP1.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)'; IdHTTP1.Request.ContentLength := -1; IdHTTP1.Request.Connection := 'Keep-Alive'; IdHTTP1.Request.CacheControl := 'no-cache'; IdHTTP1.Request.CustomHeaders.Add('SOAPAction: "http://tempuri.org/AAA"'); Params.Text := '<?xml version="1.0" encoding="utf-8"?>' + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' + 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' + ' <soap:Body>' + ' <AAA xmlns="http://tempuri.org/" />' + ' </soap:Body>' + '</soap:Envelope>'; try params.SaveToFile(ExtractFilePath(ParamStr(0)) + 'my.txt'); html := Utf8ToAnsi(IdHTTP1.Post('http://192.168.2.26/Services/App/WebService.asmx', Params)); except //showmessage('error'); end; memo2.Text := IdHTTP1.ResponseText; IdHTTP1.Disconnect; FreeAndNil(IdHTTP1); FreeAndNil(Params);end;</span>
0 0
- http 调用soap webservice
- webservice http soap
- python用http发送soap报文进行webservice接口调用
- webservice调用方式http和soap的区别
- C# 利用Http Get,Post,Soap调用WebService
- soap HTTP 调用
- PHP5 SOAP调用.NET WebService
- ASP通过SOAP调用WebService
- VC通过SOAP调用WebService
- Webservice调用方式:axis,soap
- C#实现SOAP调用WebService
- PHP5 扩展SOAP 调用 webservice
- PHP调用webservice soap soapclient
- 使用Soap方式调用Webservice
- C#实现SOAP调用WebService
- C# 调用Get,Post,Soap调用WebService
- RPC方式调用webservice SOAP调用
- php soap 调用webservice 已测试成功
- 如何能让Excel快速生成一个序列
- ios webView 加载本地html5
- HDU-1430 魔板
- LeetCode|Excel Sheet Column Number-java
- linux部署java项目
- http 调用soap webservice
- HDU_3468_Treasure Hunting([二分图匹配 / 最大流] + 最短路)
- test3.1
- 投-票流程
- java 文件续传
- editplus安装和注册
- android 快速开发(一)抽象类的使用:使业务逻辑更清晰
- 不使用composer安装yii2-jui的方法
- ubuntu14.04下ldtp环境配置