title: How to Prevent dialog (Basic Authentication prompt) during call of Webservice
body: <p>In a delphi program (running as a service) i need to call some webservices.<br>
  The calls works fine if basic Authentications is not requerired. The calls also works fine if Basic Authentication is requerired and username/password is provided (in BeforePost) using: </p>
  
  <pre><code>InternetSetOption(Data, INTERNET_OPTION_USERNAME,...
  InternetSetOption(Data, INTERNET_OPTION_PASSWORD,...
  </code></pre>
  
  <p>But if Basic Authentication is Requeried, and username/password is not provided, the program brings up af prompt for the username/password (thats a NO-GO in a servcice).  </p>
  
  <p>So how can I signal that i DON'T want a prompt, but instead an error?  </p>
  
  <p>The problem is, as i can se it, in the SOAPHTTPTrans function THTTPReqResp.Send(const ASrc: TStream): Integer; (line 762 (second call to InternetErrorDlg i that method)).</p>
  
  <p><strong>EDIT1:</strong><br>
  if i change the Flags in the beginning of the send method (in SOAPHTTPTRANS) to include INTERNET_FLAG_NO_AUTH, it works as i wanted.<br>
  But how do i do that without changing the SAOPHTTPTrans (if possible)?</p>
  
  <p><strong>EDIT2:</strong>  </p>
  
  <pre><code>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;
  </code></pre>
  
  <p>Where AvailabilityServiceSoap is the interface generated using the WSDL importer.</p>