Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Webservice Authentification über SOAP Header (https://www.delphipraxis.net/111263-webservice-authentification-ueber-soap-header.html)

DonMaddin 1. Apr 2008 12:14


Webservice Authentification über SOAP Header
 
Hallo,

wir versuchen uns gerade an einem Plattformübergreifenden Webservice, d.h. er wurde in C# unter VS2008 geschrieben und soll auch unter Delphi benutzbar sein.

Dabei geht insbesondere um die Authentifizierung des Users.

Unter C# gehe ich so vor:
Code:
DummyService service = new DummyService();
ValidationHeader header = new ValidationHeader();
header.PassToken = "sody";
service.ValidationHeaderValue = header;

Console.WriteLine(service.HelloWorld_Secured());
Console.WriteLine(service.HelloWorld_Secured_Admin());
Console.WriteLine(service.HelloWorld_Simple());
Console.WriteLine(service.Test_A_Minus_B(10, 5).ToString());

Console.ReadLine();
Beispiel in ASP.NET

Ich habe mit dem Delphi Assistenten die WSDL importiert.
Ich kann die Function "HelloWorld_Simple" ausführen.
Nur wenn ich die Function "HelloWorld_Secured" bekomme ich eine Exception. :cry:

Delphi-Quellcode:
procedure TForm1.btnExeClick(Sender: TObject);
const
  defWSDL = 'http://89.106.221.77/dummyws/DummyService.asmx?wsdl';
  defURL = 'http://89.106.221.77/dummyws/DummyService.asmx';
var myDummyServiceSoap : DummyServiceSoap;
    myValidationHeader : ValidationHeader;
    myHTTPRIO: THTTPRIO;
    myHTTPReqResp: THTTPReqResp;
begin
  myHTTPReqResp := THTTPReqResp.create(nil);
  myHTTPReqResp.Password := edtUser.Text;
  myHTTPReqResp.username := edtUser.Text;
  myHTTPRIO := THTTPRIO.create(nil);
  myHTTPRIO.HTTPWebNode := myHTTPReqResp;
  myHTTPRIO.URL := defURL;
  myValidationHeader := ValidationHeader.Create();
  myValidationHeader.PassToken :=edtUser.Text;
  myDummyServiceSoap:=GetDummyServiceSoap(True,defWSDL,myHTTPRIO);
  lblSimple.Caption:='HelloWorldSimple: '+myDummyServiceSoap.HelloWorld_Simple;
  lblSecured.Caption:='HelloWorldSecured: '+myDummyServiceSoap.HelloWorld_Secured;
end;
Wie muss ich die Authentification unter Delphi machen?

Danke
Martin


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:01 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz