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.

**Soap 1.x Security Feature Support** The Web Service Proxy Generator supports transport level authentication and basic SoapHeader based authentication - part of the standard Soap 1.x spec. It does not work with WS-Security/WSE type of message header security as the generator does not support WS-* protocols. For that WCF needs to be used with manually created .NET proxies. If you need to access WS-* services we can help with custom consulting services.

© West Wind Technologies, 2004-2020 • Updated: 09/29/15
Comment or report problem with topic