2

I have a WCF-Service i want to access with a Delphi-Client. Now my problem is, that I have to use Windows Authentication and don't know where to tell the Delphi-Client to use those credentials automatically.
It only works if I start the client on the same machine as the WCF (of course). Otherwise I get a ESOAPHTTPException with Error 401 (Unauthorized).

In a C#-Client it's just some configuration like

<transport clientCredentialType="Windows" />

But how to configure the Delphi-Client to use Windows Credentials?

EDIT:
All I did in Delphi to test if it's working is importing the wsdl and executing the following:

procedure TForm1.Button1Click(Sender: TObject);
var
  trans: IService;
begin
  trans := Service_Transfer.GetIService();
  Label1.Caption := trans.GetPath;
end;
mjn
  • 36,362
  • 28
  • 176
  • 378
Obl Tobl
  • 5,604
  • 8
  • 41
  • 65
  • You show no code so it's hard to help. How do you connect to the WCF service? How did you create the proxy? What have you configured for it? It's highly unlikely that the proxy has no way to specify credentials. Anyway, all desktop applications use the credentials of the current user. If the application works locally but not remotely, you may be logging in with local accounts instead of a domain account. – Panagiotis Kanavos Feb 13 '15 at 11:20
  • what delphi version are you using? – whosrdaddy Feb 13 '15 at 11:53
  • You can pass credentials via THTTPRIO.Webnode, in the format: Domain\user – whosrdaddy Feb 13 '15 at 11:58
  • @whosrdaddy i use XE2. How to pass windows credentials automatically in Webnode? – Obl Tobl Feb 13 '15 at 12:06
  • 2
    Good question, I never found a solution how to do this, I have had the same problem, I ended up making a .NET COM DLL that did the WCF calls... – whosrdaddy Feb 13 '15 at 12:12
  • 2
    SOAP stands for Standard OAP... But there is nothing less standard that SOAP as implemented by WCF. It works OK from WCF clients, but even on Java we already had problems working with a WCF SOAP server besides the most simple mode. Once you include credentials, it is a nightmare... even with .Net clients BTW... At the end, we usually wrote some C# dll hosting COM components, which we called from Delphi. Just like @whosrdaddy... Just a PITA. – Arnaud Bouchez Feb 13 '15 at 14:27
  • Thanks guys for the hint. Maybe thats the best workaround if there is no other solution. – Obl Tobl Feb 13 '15 at 14:56
  • Have you tried tools like SoapUI or Fiddler2 for testing / logging of the web service request and response content? – mjn Feb 20 '15 at 11:00
  • See my answer for [How can I use NTLM authentication in a Delphi SOAP Web Service client?](http://stackoverflow.com/questions/1068452/how-can-i-use-ntlm-authentication-in-a-delphi-soap-web-service-client): In the user name property of the WebNode subcomponent of the THTTPRio component, use the domain name followed by a backslash and the user name – mjn Feb 20 '15 at 11:03

1 Answers1

0

If client and server are on different computers, the client must use a valid domain account.

See my answer for How can I use NTLM authentication in a Delphi SOAP Web Service client?:

In the user name property of the WebNode subcomponent of the THTTPRio component, use the domain name followed by a backslash and the user name.

Note that accessing the Web Service WSDL address from a different computer (in the same network) with a normal web browser (Chrome, Firefox, ...) should present a login form, where the credentials in the form domain\user and password can be entered.

Community
  • 1
  • 1
mjn
  • 36,362
  • 28
  • 176
  • 378
  • 1
    But how to use the credentials of the logged-in user? Other ways were already discussed in the comments. – Obl Tobl Feb 20 '15 at 13:22