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
Antwort Antwort
Benutzerbild von TERWI
TERWI

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

AW: FritzBox auslesen - Problem SOAP-Abfrage

  Alt Gestern, 09:42
@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.
  Mit Zitat antworten Zitat
Antwort Antwort

 

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 12:12 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