Share via


TryHandleWebMethodException Method (Exception, HttpWebRequest)

Handles SoapExceptions and WebExceptions raised from a Web service method call.

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

Syntax

'Declaration
Public Function TryHandleWebMethodException ( _
    ex As Exception, _
    webRequest As HttpWebRequest _
) As AgentExceptionHandlerResult
'Usage
Dim instance As ServiceAgent
Dim ex As Exception
Dim webRequest As HttpWebRequest
Dim returnValue As AgentExceptionHandlerResult

returnValue = instance.TryHandleWebMethodException(ex, _
    webRequest)
public AgentExceptionHandlerResult TryHandleWebMethodException(
    Exception ex,
    HttpWebRequest webRequest
)
public:
AgentExceptionHandlerResult TryHandleWebMethodException(
    Exception^ ex, 
    HttpWebRequest^ webRequest
)
public function TryHandleWebMethodException(
    ex : Exception, 
    webRequest : HttpWebRequest
) : AgentExceptionHandlerResult

Parameters

Return Value

Type: Microsoft.CommerceServer..::.AgentExceptionHandlerResult
A status code indicating to the caller whether the ServiceAgent object handled the exception, and if so, whether the operation that resulted in the exception should be aborted or retried. It is also possible that this method raises a different exception or maps the exception to a new exception type.

Remarks

The key service provided by the ServiceAgent class is handling of exceptions in a consistent manner. Working together with server-side methods, this permits exceptions that were raised by the Web service to be transmitted to the client as a SoapException and then mapped back to the original exception type by the agent and re-raised. This method also works to handle authentication-related WebExceptions.

Permissions

See Also

Reference

ServiceAgent Class

ServiceAgent Members

TryHandleWebMethodException Overload

Microsoft.CommerceServer Namespace