ServiceAgent Class

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Provides authentication and SOAP proxy services to the MarketingContext and CatalogContext objects when initialized to communicate with and authenticate against a Web service.

Namespace:  Microsoft.CommerceServer
Assembly:  Microsoft.CommerceServer.CrossTierTypes (in Microsoft.CommerceServer.CrossTierTypes.dll)

Syntax

'Declaration
Public MustInherit Class ServiceAgent
'Usage
Dim instance As ServiceAgent
public abstract class ServiceAgent
public ref class ServiceAgent abstract
public abstract class ServiceAgent

Remarks

When authenticating against a Web service, the default behavior of the ServiceAgent is to first try to make Web service method calls without any authentication credentials. If an Authentication related exception results (e.g. HTTP 401 response from the Web server), then the next step is to try using the user's default credentials, if available. If those credentials are not available or also fail, and the ServiceAgent has been provided with a IPromptForCredentials implementation, then the PromptForCredentials method is invoked to retrieve alternate credentials for the user. This typically involves displaying a dialog box to a user in order to prompt them to input new credentials. These credentials are then cached in a CredentialCache object and re-used when issuing further method calls against the service. If it is desirable to use credentials other than the user's default credentials, then such credentials can be provided at the time the ServiceAgent object is constructed, and before it is used to initialize a Catalog or Marketing agent object. From a security perspective, it is important to note that the ServiceAgent sets the UnsafeAuthenticatedConnectionSharing property of the new proxy to true by default. This can be unsafe from a security perspective if the ServiceAgent is used in an environment where more than one security context is using ServiceAgent objects to connect to Web services from within the same process and using different credentials. The typical example is when the agent is invoked from an ASP.NET Web application or Web service and impersonation is being used in the Web application. In this case, you should disable UnsafeAuthenticatedConnectionSharing by setting the UnsafeAuthenticatedConnectionSharing property to false.

The following objects derive from ServiceAgent:

Inheritance Hierarchy

System..::.Object
  Microsoft.CommerceServer..::.ServiceAgent
    Microsoft.CommerceServer.Catalog..::.CatalogServiceAgent
    Microsoft.CommerceServer.Marketing..::.MarketingServiceAgent
    Microsoft.CommerceServer.Orders..::.OrderServiceAgent
    Microsoft.CommerceServer.Profiles..::.ProfilesServiceAgent

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ServiceAgent Members

Microsoft.CommerceServer Namespace