Moin zusammen !
Für ein kleines Projekt habe ich mit "Know-How-Transfer" aus hier vorhanden Quellen etwas übersichtlicheres zusammengebaut und erweitert..
"Discover" auch mehrerer Boxen funktioniert mit auslesen der TR-064- und verfügbaren uPNP-
XML-Daten funzt prima.
Login's (hier zunächst nur "neuere"
OS ab 7.5x) sind auch problemlos.
… fehlt nur noch das lesen & schreiben wünschenswerter Daten mittels "Seifen-Oper".
Ich verzweifele jedoch schon an dem Beispiel "10.5
SOAP Request with Action GetSecurityPort" aus dem PDF "AVM_TR-064_first_steps".
Die Fritz-Mädels quittieren meine
SOAP-Anfragen mit permanentem ERROR 500/502.
Das sieht in Kürze mit
INDY statt mit Winsock hier etwa so aus:
(Funktioniert beim Rest einwandfrei)
Delphi-Quellcode:
Aufruf mit;
control := '
/upnp/control/deviceinfo';
service := '
urn:dslforum-org:service:DeviceInfo:1';
action := '
GetSecurityPort';
Global:
FBoxAct^.IP := '
Fritz.Box';
// oder jeweilige IP
cFB_PORT_TCP := 49000;
function TDATA.Read_SOAP(Service, Action, Control :
string):
string;
var
url, SA :
string;
Content : TStringList;
HTTP : TIdHTTP;
begin
result := '
?';
url := Format('
http://%s:%d%s', [FBoxAct^.IP, cFB_PORT_TCP, Control]);
SA := Format('
SoapAction:%s#%s', [Service, action]);
try
Content := TStringList.Create;
Content.Add('
<?xml version="1.0"?>');
Content.Add('
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">');
Content.Add('
<s:Body>');
Content.Add(Format('
<u:%s xmlns:u=%s></u:%s>', [Action, Service, Action]));
Content.Add('
</s:Body>');
Content.Add('
</s:Envelope>');
Log('
Read_SOAP', Content.Text);
HTTP := TIdHTTP.Create(
nil);
HTTP.Request.Accept := '
text/xml';
HTTP.Request.ContentType := '
text/xml';
HTTP.Request.Charset := '
utf-8';
HTTP.Request.CustomHeaders.Add(SA);
result := HTTP.Post(
url, Content);
except
on E: EIdHTTPProtocolException
do
begin
Log('
Read_SOAP', '
ERROR: ' + inttostr(E.ErrorCode) + '
|' + E.ErrorMessage);
end;
end;
Content.Free;
HTTP.Free;
end;
Mein CONTENT-LOG sieht so aus:
Code:
<?
xml version="1.0"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/
soap/envelope/">
<s:Body>
<u:GetSecurityPort xmlns:u=urn:dslforum-org:service:DeviceInfo:1></u:GetSecurityPort>
</s:Body>
</s:Envelope>
Mein ERROR-LOG sieht so aus:
Code:
ERROR: 500 |
<?
xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/
soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:dslforum-org:control-1-0">
<errorCode>502</errorCode>
<errorDescription>
XML error</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Mit
XML hab ich mich schon länger angefreundet, aber
SOAP will nicht mein Freund werden ?!
Habe reichlich im WWW recherchiert - leider keine Lösung - kein Blitz hier.
Falsche, fehlende HTTP.Request Angaben / Einstellungen ?
Irgendwo ' " ' zu wenig / zu viel ? (probiert, keine Änderung)
... Hilfe bitte - in bin da leider überfordert.