Lac*_*ika 8 delphi soap-client
如何保存对xml的soap响应?我尝试使用tstringlist,filestream,创建了xml文件,但是我得到了
无法将varinat类型(null)转换为(type(olestr)
我尝试了这个简单的代码.响应不是空的.文件大小40MB.Delphi XE3.
procedure TForm1.HTTPRIO1AfterExecute(const MethodName: string;
SOAPResponse: TStream);
var xml : TStringlist;
begin
xml := TStringlist.create;
try
soapresponse.Position:=0;
xml.LoadFromStream(SOAPResponse);
xml.SaveToFile('...file.xml');
finally
xml.Free;
end;
end;
Run Code Online (Sandbox Code Playgroud)
这是问题(空行)?或不 ?
...
- <leiras>
- <![CDATA[
* Socket AM2 for AMD Athlon™ 64FX / 64X2 / 64 and Sempron processors
* ULi M1697
1. Supports FSB 1000MHz (2.0GT/s), Hyper-Transport Technology and AMD Cool 'n' Quiet Technology
2. Untied Overclocking : During Overclocking, FSB enjoys better margin due to fixed PCIE/ PCI Buses
3. Supports Dual Channel DDRII800/667/533, 4 x DIMM slots, with maximum capacity up to 8GB
4. Hybrid Booster - ASRock Safe Overclocking Technology
5. Supports Dual Graphics XLI
6. 1 x PCI Express x16 slot
7. 1 x PCI Express x 8 slot, to adopt 2nd PCI Express x 16 VGA card and other PCI Express x4, x2, x1 interface cards
8. 2 x PCI Express x1 slots
9. 4 x Serial ATA II 3.0Gb/s, support RAID (RAID 0, 1, 0+1, JBOD and RAID 5), NCQ, AHCI and "Hot Plug" functions
10. 2 x eSATAII 3.0Gb/s, support NCQ, AHCI and "Hot Plug" functions
11. HDMI_SPDIF header, providing SPDIF audio output to HDMI VGA card, allows the system to connect HDMI Digital TV/projector/LCD devices.
12. 7.1 Channel with High Definition Audio
13. Windows Vista™ Premium Logo Hardware Ready
14. ASRock 8CH_eSATAII I/O: 2 eSATAII ports, HD 7.1 channel audio jacks
]]>
</leiras>
<kepek />
...
Run Code Online (Sandbox Code Playgroud)
我试过NullStrictConvert:= False; 没有转换错误,但exe使用1GB RAM,直到我关闭它.
...
var xml : TStringlist;
begin
xml := TStringlist.create;
NullStrictConvert := False;
try
soapresponse.Position:=0;
...
Run Code Online (Sandbox Code Playgroud)
尝试对临时字符串变量使用流的 Read 方法:
procedure TForm1.HTTPRIO1AfterExecute(const MethodName: string; SOAPResponse: TStream);
var
s: string[200];
ds: string;
n: Longint;
xml: TStringList;
begin
SOAPResponse.Position := 0;
xml := TStringList.Create;
try
ds := EmptyStr;
while SOAPResponse.Position < SOAPResponse.Size do begin
n := SOAPResponse.Read(s[1], 200);
SetLength(s, n);
xml.Text := xml.Text + ds;
end;
xml.SaveToFile('...file.xml');
finally
xml.Free;
end;
end;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4974 次 |
| 最近记录: |