Thema: HTTPRio + SSL

Einzelnen Beitrag anzeigen

BerTa

Registriert seit: 31. Aug 2004
Ort: Dinklage
77 Beiträge
 
Delphi 7 Enterprise
 
#3

AW: HTTPRio + SSL

  Alt 5. Jan 2018, 09:15
Hi,
schonmal Danke für die Antwort.

Code:
  if not assigned(HTTPRio1_Stream) then
  begin
    HTTPRio1_Stream := THTTPRio_Stream.Create(versandBrwFrm);
  end;
  HTTPRio1_Stream.WSDLLocation   := 'C:\Dokumente und Einstellungen\user\Desktop\PriPS.xml';
  HTTPRio1_Stream.Port           := 'PriPSPort';
  HTTPRio1_Stream.Service        := 'PriPSService';
  HTTPRio1_Stream.OnBeforeExecute := HTTPRIO1_StreamBeforeExecute;
  HTTPRio1_Stream.OnAfterExecute := HTTPRIO1_StreamAfterExecute;

  Service := HermesPriPS.GetPriPS(True,'',HTTPRio1_Stream);

  hdr := verifyingToken.Create;
  hdr.UserID := 'XXX';
  hdr.UserPW := 'XXX';

  HTTPRio1_Stream.SOAPHeaders.SetOwnsSentHeaders(true);
  HTTPRio1_Stream.SOAPHeaders.Send(hdr);

  Service.pripsCheckAvailability();
Den Request setze ich bei BeforeExecute manuell zusammen, da Delphi mir ansonsten den Header nie vernünftig hinzugefügt hat:

Code:
  try
    UebXml := TXMLDocument.Create(nil);
    UebXml.Active := True;
    UebXml.Version := '1.0';
    UebXml.Encoding := 'UTF-8';
    UebXml.Options := UebXml.Options + [doNodeAutoIndent];

    UebXml.DocumentElement := UebXml.CreateNode('soapenv:Envelope', ntElement, '');
    UebXml.DocumentElement.Attributes['xmlns:soapenv'] := 'http://schemas.xmlsoap.org/soap/envelope/';
    UebXml.DocumentElement.Attributes['xmlns:wsse'] := 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd';
    UebXml.DocumentElement.Attributes['xmlns:wsu'] := 'http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd';

    lXmlNode := UebXml.DocumentElement.AddChild('soapenv:Header').AddChild('wsse:Security');
    lXmlNode.Attributes['soapenv:mustUnderstand'] := '1';
//    lXmlNode.Attributes['xmlns:wsse'] := 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd';
//    lXmlNode.Attributes['xmlns:wsu'] := 'http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd';

    lXmlNode := lXmlNode.AddChild('wsse:UsernameToken');
    lXmlNode.Attributes['wsu:Id'] := 'UsernameToken-102';
    lXmlNode.AddChild('wsse:Username').NodeValue := 'XXX';
    lXmlNode := lXmlNode.AddChild('wsse:Password');
    lXmlNode.Attributes['Type'] := 'http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText';
    lXmlNode.NodeValue := 'XXX';

    lXmlNode := UebXml.DocumentElement.AddChild('soapenv:Body').AddChild('pripsCheckAvailability');

    SOAPRequest.Size    := 0;
    SOAPRequest.Position := 0;

    UebXml.Active := True;
    UebXml.Active := True;
    UebXml.SaveToStream(SOAPRequest);
  finally
    if assigned(UebXml) then
    begin
      UebXml.Active := false;
      UebXml   := nil;
    end;
  end;
Der Request sieht auch meiner Meinung nach richtig aus, der ähnliche Weg funktioniert an anderer Stelle auch, nur hier isr keine SSL verschlüsselung vorhanden.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1">
      <wsse:UsernameToken wsu:Id="UsernameToken-102">
        <wsse:Username>xxx</wsse:Username>
        <wsse:Password Type="http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxx</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </soapenv:Header>
  <soapenv:Body>
    <soapenv:pripsCheckAvailability/>
  </soapenv:Body>
</soapenv:Envelope>
alles läuft, aber nichts geht...
  Mit Zitat antworten Zitat