In a delphi program (running as a service) I need to call some web services.
Calls work fine if basic authentication is not required. Calls also work just fine if basic authentication is required, as well as a username / password (in BeforePost) using:
InternetSetOption(Data, INTERNET_OPTION_USERNAME,... InternetSetOption(Data, INTERNET_OPTION_PASSWORD,...
But if basic authentication is requested, and the username / password is not provided, the program calls the af prompt for the username / password (i.e. NO-GO in the servlet).
So, how can I signal that I DO NOT want an invitation, but instead an error?
The problem is that, how can I use it, in the SOAPHTTPTrans function THTTPReqResp.Send (const ASrc: TStream): Integer; (line 762 (second call to InternetErrorDlg by this method)).
EDIT1:
if I change the flags at the beginning of the submit method (in SOAPHTTPTRANS) to include INTERNET_FLAG_NO_AUTH, it works the way I wanted.
But how can I do this without changing SAOPHTTPTrans (if possible)?
EDIT2:
ws := THTTPRIO.Create(Self); ws.URL := 'http://excample.com/ws.asmx'; ws.HTTPWebNode.InvokeOptions := [soIgnoreInvalidCerts]; ws.HTTPWebNode.OnBeforePost := WebServiceCallBeforePost; AvailabilityWebservice := (ws as AvailabilityServiceSoap); sTemp := AvailabilityWebservice.GetVersion;
Where AvailabilityServiceSoap is the interface generated using the WSDL importer.
BennyBechDk
source share