How to send WCF ClientCredentials using Delphi XE

I developed a WCF service with a custom UserNamePasswordValidator with basicHttpBinding using HTTPS. It works great with .Net client, using ClientCredentials to send username and password for authentication.

However, I need to call this from the Delphi XE client. How to send .Net equivalent of ClientCredentials using Delphi? Is it possible? If so, how? If this is not the case, are there any alternatives?

Tks

EDIT

Below is my client side code in .Net:

 EndpointAddress oTransac = new EndpointAddress(GetAddress()); using (WebServiceClient oClient = new WebServiceClient ("httpbasic", oTransac)) { oClient.ClientCredentials.UserName.UserName = "username"; oClient.ClientCredentials.UserName.Password = "password"; oClient.DoStuff(); } 

EDIT

I do some research and I was able to authenticate between Delphi and old asmx web services using SOAP Hearders. I found the article below. Can I achieve the same behavior of the old [WebMethod] [System.Web.Services.Protocols.SoapHeader("SoapHeader")] using the technique of the article?

http://weblogs.asp.net/paolopia/archive/2008/02/25/handling-custom-soap-headers-via-wcf-behaviors.aspx

EDIT BOUNTY

Received by marking as the correct response to generosity, I would like to be able to call the web service from Delphi using the WCF service UserNamePasswordValidator on the server side.

+8
authentication delphi wcf soapheader
source share
2 answers

First, basicHttpBinding is done via HTTP (not HTTPS)

http://msdn.microsoft.com/en-us/library/ms731361.aspx

To use the WFC service from Delphi, it is usually done by creating WSDL from the service

How to create one WSDL file from an existing WCF service?

http://social.msdn.microsoft.com/Forums/en/wcf/thread/fc2c5074-1116-4f92-a972-01bb3a142535

WCF: how to generate one WSDL without WSDL: import?

and creating a Delphi proxy class by importing this WSDL into your Delphi project.

 >wsdlimport.exe service.wsdl 

and then use the created Delphi module in a Delphi project

http://www.drbob42.com/examines/examinB9.htm

http://edn.embarcadero.com/article/36962

The parameters that you send to service calls (username, password, ClientCredientials, etc.) will be defined in the generated Delphi block - there should be no problems if you can connect to the service.

+5
source share

A few weeks ago, I also had to connect to the WCF service. I ended up writing a client in .net and used UnmanagedExports https://sites.google.com/site/robertgiesecke/Home/uploads/unmanagedexports

Then dll can be used in Delphi, like a native dll

+1
source share

All Articles