Call this function to pre-authenticate the request. This function applies only to webservices that use basic authentication mechanism. This method is available for .NET Web services engine only.
conn.EnablePreAuthentication()
Argument | Description |
---|---|
conn | The name of the SoapConnection object that establishes the connection. |
Long. Valid values are 0 for success and 50 for failure.
To summarize, any call to a Web service's method generates at least one 401 error for basic authentication. This behavior does not work with some older versions of the Apache HTTP server, however, and sends a 500 response if a client does not include credentials on the very first request to the server. This behavior violates the guidance from RFCs 2616 and 2617, which suggests that a server should respond with a 401 to a request that has no Authorization header.
To call Web Services located in older Apache servers, or to decrease the roundtrips to the server which you have trusted in advance, call the EnablePreAuthentication function of SoapConnection before you create the proxy object. When calling this function, the WWW-authenticate header is sent with the first request for basic authentication.