10.4. Usage Accounting

The next SOAP extension we'll build is for usage accounting or metering. The idea is to intercept each incoming request and log it to the AccountUsage database table with the userid, method name, and request time. It would also be nice if the extension could optionally log the time that the response was sent back to the client. That way you also get an idea of how long each method invocation took. Listing 10.8 shows the Accounting SOAP extension implementation.

Listing 10.8. The usage accounting SOAP extension (VBWSBook\Chapter10\Infrastructure\Accounting.vb)
 Public Structure AccountingExtensionConfig Public ConnStr As String Public LogResponse As Boolean End Structure Public Class Accounting Inherits System.Web.Services.Protocols.SoapExtension ...

Get Real World XML Web Services: For VB and VB .NET Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.