Setting Credentials on the Service Request
Web Service requests may require protocol based HTTP credentials in order to access the Web Service over the Web. The .NET proxy includes a Credentials property that can be used to set this security.
The generated FoxPro (and .NET) proxy includes an HttpLogin(username, password, preauthenticate) method that can be used to set a username and password or use the default windows credentials (if calling a Web Service secured with Windows Security).
*** Call service that requires Credentials
DO webstoreadminserviceproxy.PRG
*** Create Proxy for .NET version 4.0
LOCAL oProxy as WebStoreAdminServiceProxy
oProxy = CREATEOBJECT("WebStoreAdminServiceProxy","V4")
oProxy.HttpLogin("rick","supersecret",.T.)
loItem = oProxy.Downloadinventoryitem("wconnect50")
The login method can receive either username and password or a fixed value of "Windows" (any case) which uses the currently loggged in user's credentials.
*** Use current Windows Credentials
oProxy.HttpLogin("Windows")
Note that the "Windows" credentials only work with services that use Windows authentication on the server - otherwise username and password are required.
© West Wind Technologies, 2004-2020 • Updated: 09/29/15
Comment or report problem with topic