@Michael --- 1000 DANK ! YEPP - funzt !
TStringStream statt TStringList macht den elementaren Unterschied.
Insbesondere m.E.n. das UTF-8 Encoding der "Seifenschachtel" ?!
Vermutung: Neben der Ansage via ContentType das UTF-8 kommt, muss das bei
SOAP anscheinend auch machen.
Beim lesen von Desription's und zugehörigen SCPD-Dateien via
XML scheint das offensichtlich unkritisch.
Das hier funktioniert nun tadellos:
Delphi-Quellcode:
function TDATA.Read_SOAP(Path, Service, Action :
string):
string;
var url :
string;
HTTP : TIdHTTP;
SoapReq :
string;
SoapStream : TStringStream;
begin
result := '
?';
url := Format('
http://%s:%d%s', [FBoxAct^.IP, cFB_PORT_TCP, Path]);
Log('
Read_SOAP',
url);
SoapReq := '
<?xml version="1.0" encoding="utf-8"?>' +
'
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ' +
'
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">' +
'
<s:Body>' +
Format('
<u:%s xmlns:u=%s></u:%s>', [Action, Service, Action]) +
'
</s:Body>' +
'
</s:Envelope>';
try
SoapStream := TStringStream.Create(SoapReq, TEncoding.UTF8);
HTTP := TIdHTTP.Create(
nil);
HTTP.Request.ContentType := '
text/xml';
HTTP.Request.Charset := '
utf-8';
HTTP.Request.CustomHeaders.Values['
SOAPAction'] := Format('
%s#%s', [Service, Action]);
result := HTTP.Post(
url, SoapStream);
// Content);
except
on E: EIdHTTPProtocolException
do
Log('
Read_SOAP', '
ERROR: ' + inttostr(E.ErrorCode) + '
|' + E.ErrorMessage);
end;
SoapStream.free;
HTTP.Free;
end;
Wie erwartet kommt das zurück:
Code:
<?
xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/
soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/">
<s:Body>
<u:GetSecurityPortResponse xmlns:u="urn:dslforum-org:service:DeviceInfo:1">
<NewSecurityPort>49443</NewSecurityPort>
</u:GetSecurityPortResponse>
</s:Body>
</s:Envelope>
Basis ist da - schaue ich mal, ob SSL notwendig ist und wie es sich beim schreiben via
SOAP verhält.
Insbesondere bei notwendigem Login und Übergabe notwendiger Daten.