AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

FritzBox auslesen - Problem SOAP-Abfrage

Ein Thema von TERWI · begonnen am 25. Sep 2025 · letzter Beitrag vom 26. Sep 2025
 
Benutzerbild von TERWI
TERWI

Registriert seit: 29. Mär 2008
Ort: D-49626
388 Beiträge
 
Delphi 11 Alexandria
 
#1

FritzBox auslesen - Problem SOAP-Abfrage

  Alt 25. Sep 2025, 13:25
Delphi-Version: 12 Athens
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.
  Mit Zitat antworten Zitat
 

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:45 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz