I want to create an Exchange Web Services (EWS) client application using Delphi XE6.
I am using a THttpRio component with a wsdl. How do I set the user credentials? In other languages, the equivalent of the THttpRio component has a Credentials property (example). But this is missing from the Delphi component.
The authentication mechanism (apart from impersonation) is not part of the ews wsdl. It is native to the SOAP layer.
Listing 1:
procedure TForm1.Button1Click( Sender: TObject);
var
lESB : ExchangeServicePortType;
request : GetServiceConfiguration;
Impersonation : ExchangeImpersonation;
RequestVersion: RequestServerVersion;
MailboxCulture1: MailboxCulture;
GetServiceConfigurationResult: GetServiceConfigurationResponse;
ServerVersion : ServerVersionInfo;
begin
lESB := HTTPRIO1 as ExchangeServicePortType;
request := GetServiceConfiguration.Create;
request.RequestedConfiguration := ArrayOfServiceConfigurationType.Create( 'UnifiedMessagingConfiguration');
Impersonation := ExchangeImpersonation.Create;
RequestVersion := RequestServerVersion.Create;
MailboxCulture1 := MailboxCulture.Create;
GetServiceConfigurationResult:= GetServiceConfigurationResponse.Create;
ServerVersion := ServerVersionInfo.Create;
try
lESB.GetServiceConfiguration(
request, Impersonation, RequestVersion, MailboxCulture1,
GetServiceConfigurationResult, ServerVersion)
finally
request.Free;
Impersonation.Free;
RequestVersion.Free;
MailboxCulture1.Free;
GetServiceConfigurationResult.Free;
ServerVersion.Free
end
end;
Listing 1 above, shows some sample code, that I have tried so far. The purpose of the function is to get the version information about the server. HTTPRIO1 is a THTTPRIO component with default properties, and hooked up to the standard wsdl for EWS. This doesn't work because user credentials are not set.
How to set the user credentials?
THTTPRIO.HTTPWebNode(THTTPReqResp) property where you have theUserName/Password, or did I miss something? - kobik