A Generic Charging Policy Based Accounting for Web Services

: Problem statement: Metering and charging are basic accounting functions that are essential for commercial usage of web services. Current charging and accounting schemes primarily involve users being charged flat or based on the connection/session time. Accounting management of web services should provide for metering, charging, accounting, billing, payment and auditing. We have extended our earlier work, a Policy based Accounting for Web Services (WS-PACT), to develop a generic and comprehensive charging policy that can cater to different charging patterns. WS-PACT provides a flexible model to meet the varying billing and payment needs of service providers. Approach: Policies are expressed in WS-Policy and policy query facility has been developed using XQuery. Results: Users can use the query facility to obtain the charges being levied and can decide on which services to use by taking into account their preferred spending limits and payment patterns. Conclusion: We have implemented and tested the charging policy and query facility with a sample application.


INTRODUCTION
Authentication, Authorization and Accounting (AAA) is a management framework that is used to enforce control for access of various computing resources. Authentication is the process to verify the uniqueness of an user, Authorization is the process of asserting whether a user should be granted or denied access to a particular service or resource and Accounting deals with keeping track of usage of resources and related payment process. According to IETF, accounting management should provide for metering, charging, accounting, billing, payment and auditing (Aboba et al, 2002). Metering is the function that collects the information regarding service or resource usage (Ruiz-Agundez et al., 2010) while charging is the process of calculating the cost of the services or resources usage according to the pricing strategies (Zhang et al, 2005). Accounting is the process of filtering, collecting and aggregating the information of resource usage while billing is the process of using the accounting information to generate a bill that is delivered to a user (Aboba et al., 2002). Payment defines a well-defined scheme of money exchange between the users and service providers. The act of verifying the correctness of the accounting process and procedures is termed as auditing (Rensing et al., 2002).
The charging and accounting schemes currently used for web services have been relatively simple. Users have so far been charged either a flat rate or on basis of Internet connection/session time. There is a need to integrate charging and accounting with the provisioning of web services to enable service providers to bill users for their service usage (MuthuLakshmi and Anand, 2012). However, the distributed nature of web service components poses a big challenge for web service accounting. Web services can also be composite that combine one or more services into a single service offering. The increase in web service usage for Ecommerce, demands the development of a comprehensive accounting framework that provides and support flexible charging / pricing models. Each service provider may like to have a unique charging and pricing methodology. There is the need to automate the metering of web service usage and to calculate the payment based on the charging patterns of individual service providers (MuthuLakshmi and Anand, 2012).
We had proposed a Policy based Accounting Architecture (WS-PACT) to integrate and automate the accounting functions and management (MuthuLakshmi and Anand, 2012) Accounting based on service charging policies provides flexibility in accounting and enables the automating of metering and charging functions to meet the service provider's requirements.
In this study, we have presented a generic and comprehensive charging policy to accommodate different pricing schemes and charging based on resource usage. The pricing patterns can be varied depending on user categorization and the billing could be for a single usage or for consolidated monthly, annual or other periodic subscription rates.
The rest of the study is organized as follows. First discussed the work related to WS-Policy and web service accounting. Then discussed in detail the charging policy and the different pricing options it supports. After that outlines the implementation of the proposed policy for a sample application with fixed and varying tariffs. At the end concludes the study.
Literature review: Service Oriented Architecture (SOA), commonly implemented using web services, models the interactions between the three roles: the service provider, service registry and service requestor as shown in Fig. 1.
The interactions between the key players include publish, find and bind operations. Service providers "publish" their services in searchable service registries. The service provider defines a service description for the web service and the service requestor or user "finds" by querying or searching the registry for a suitable web service that meets their processing requirements. The "bind" operation is used by the service requester to invoke or interact with the web service implementation of the service provider (Kreger, 2001).
We first look at policies and discuss how it has been applied to web services. Tim Gleason et al. (2005) have discussed policy management in general for web service environment (Gleason et al., 2005). Policies are designed to constrain access to resources and also state the terms of availability of any service. They have stated that users would be encouraged to use web sites where the policies are clearly stated. For instance, private policy statement is published to inform users about safeguarding their personal information and about their distribution policy. Their policy management covers policy life cycle, policy discovery and access and enforcement of policies for individual and groups of services. Baresi et al. (2006) have presented a monitoring framework for WS-BPEL processes using WSPolicy. They have represented the monitoring policy and have expressed the constraints using WS-Policy assertions. They have defined the use of a Web Service Constraint Language as a domain independent policy assertion language to specify the user requirements. The functional descriptions have been represented as assertions and the study addresses requirements like security, performanceand reliable messaging. Tosic et al. (2007) have developed WS-Policy4MASC a new XML language for defining new types of policy assertions: Goal, action, utility and meta policy assertions. This XML language also enables information for run-time policy-driven management.
W3C (World Wide Web Consortium) have defined a WS-Policy framework for expressing the requirements and capabilities of web service based systems Web Services Policy 1.5-Framework: 2007 W3C Recommendation. This framework provides a single policy language to express and evaluate all policy assertions. But this framework does not cover the aspects of scope of policy and the discovery of policy. It also does not define policy attachment mechanisms for associating policy with XML elements.
It can be seen that WS-Policy (Baresi et al., 2006) is emerging as the standard way to describe the properties that characterize a web service. The WS-Policy data model is given in Fig. 2.
WS-Policy defines a policy to be a collection of policy alternatives and each policy alternative is a set of policy assertions. Such policy alternatives and assertions can be used to specify different charging patterns of service providers. WS-Policy is machine readable and hence can be used to automate the accounting processes. However, WS-Policy does not specify how policies are discovered or attached to a web service. Policy-based accounting can therefore provide accounting architectures the flexibility to configure the accounting process as per users' needs and to automate the process of accounting. Accounting policies describe rules for generation, transport and storage of accounting data (Hartanto and Carle, 1999). Policies can be exchanged between users, service providers and the Accounting or AAA architecture.
We now discuss work related to Internet and web service usage and its charging. Felix Hartanto and Georg Carle proposed a policy based billing architecture to provide flexibility in billing for telecommunications and Internet services (Radisic, 2002). They have suggested the use of policies to implement flexible billing and discussed the definitions of policies for various charging and pricing schemes. This architecture supports flat-rate, duration-based and volume-based charging and also both static and dynamic pricing. They have suggested a charging structure of subscription charge and session charge. I Radisic have designed a policy based accounting for service oriented accounting management (Ming-Hua et al., 2003). This study described seven phases of service lifecycle; offer, negotiation, implementation, installation and test, operation, change and deinstallation. They have separated the accounting process into several sub processes and used policy based concepts to manage the accounting sub process.  (Liang et al., 2006). The study gives a general approach for charging information services and has addressed issues relating to their metering and charging. Various charging schemes have been considered taking into account the service rate and time factors. They have presented various time-based pricing plans and the associated difficulties in charging and pricing are outlined. Haiqi Liang et al. (2006) have defined a policy framework for web service customization by collaboration between service consumer and provider (Kantere et al., 2011). They have suggested the use of WS-Policy for representing the web service customization policy. A service consumer would be permitted access to a service on basis of the defined policy. However, it does not deal with charging or accounting of the web service usage. Kantere et al. (2011) has proposed a novel pricedemand model for a cloud cache. They also proposed dynamic pricing scheme for queries executed in the cloud cache (Weinhardt et al., 2011).The users can query the cloud data and pay the price for the infrastructure they use. The goal of this study is to optimize the user satisfaction and cloud profit. They have discussed the challenges related to defining an optimal pricing scheme. The first is to define a pricing model that is based on users' demand and second is to define an adaptable pricing scheme with flexibility forcorrections. Weinhardt et al. (2011) proposed different types of pricing schemes: static, flexible and dynamic and have discussed how these could be applied to web services (Ruiz-Agundez et al., 2011). Flexible pricing is realized by price discrimination and divided into Personalized Pricing, Self-Selection and Group Pricing. Igor Ruiz-Agundez et al. (2011) have presented a flexible accounting model for cloud computing services. They have discussed in detail the services of metering, charging, mediation, accounting, pricing, billing and financial clearing for cloud service accounting (Papazoglou and Yang, 2002). They have applied the Cloud Computing model using SLAs and discussed various pricing strategies like time based, volume based and on basis of quality of service. Papazoglou and Yang (2002) have presented a framework for identifying web services from business processes (Tosic et al., 2007). They have also proposed the use of various charging schemes range from simple services to complex web services. They have discussed how business process should be described so that services can be properly identified. The principles regarding functional aspects like coupling and cohesion and nonfunctional aspects such as service provisioning, billing, pricing and metering of web service have been discussed. This study does not address the implementation aspects of the charging schemes. Zhang et al. (2005) have suggested an accounting architecture for web services and have discussed the accounting entities related to web services (Zhang et al., 2005). They have suggested the use of policies for charging, billing and accounting. They have identified the challenges to the web service accounting processes and the requirements that should be considered for the web service accounting. They have discussed their accounting architecture with a case study. They have suggested the use of policies for accounting but have not gone into the details of policy definition, language or its enforcement.
Charging policy: The Policy based Accounting Architecture proposed by us as earlier work is given in Fig. 3 for easy reference.
We have proposed the use of an AAA server to maintain the Charging policy, Usage Data Records (UDR) and Accounting Records (ACR) for web service usage. AAA client component at the service provider would interface with the AAA server and provide the details of web service usage. This accounting architecture serves to distribute the collection of web service usage and automate the accounting processes. Policies would be specified by service providers. Service providers would manage the lifecycle of the policy from creation through modification to their removal when no longer valid. Policies would be enforced by AAA server and clients. The users would be able to query the policies to know the pricing details.
Charging Policies would enable service providers to define various types of charging schemes. The pricing scheme would be specified by the service provider and stored as entries in the Service Charging Policy (SCP) maintained using Ws-Policy. The service providers can have different pricing patters based on user categorization. The pricing and billing could be on pay-per-use basis or can be consolidated over a period. The bills could be raised for single usage or monthly, bi-monthly, quarterly, half yearly or annual basis as per the preference of users and service providers. Service consumers can query the XML data in the SCP to know the pricing details of web services. This would enable them to decide on a suitable web service and service provider. The user can then obtain service accessfrom the concerned service provider. The AAA Client component in the service provider monitors and records (meters) the service usage. The metering details are sent by the AAA client to the AAA server and stored as UDR. Cache facility can be used to ensure that usage records are not lost due to network failure. The charges for service usage are generated from UDR and SCP and Accounting Records (ACR) can be generated. The bills would be generated from ACR and sent to the users for payment. WS-PACT architecture enables automation of the metering of web service usage, generation of accounting records and bill generation. The payment process can be automated using a payment gateway. WS-PACT architecture provides flexibility in accounting as the metering and charging is implemented as per the service provider's requirements. WS-PACT also facilitates the user to choose web services and pricing schemes as per their individual requirements.

Generic charging policy:
In this study, we present a generic charging policy that has been designed to try and accommodate different types of charging patterns and usage. We have looked at two types of users: users who register and become members and non-members who can pay as per their usage. Users can opt for membership and in this category we have provided different policy schemes as given in Fig. 4. Users are first required to register and become members to use the web service facilities. Members could be asked to pay an amount towards membership or it could be free. Option is provided to allow users to pay either on time basis or on content basis. Time would mean the Internet time or session time for which they remain connected and use the service. Content would mean that the charges would vary depending on the resource they would access. Price would be associated with the resource being accessed. Pricing could also vary depending on specific functions that are accessed.
The policy schemes for members are as explained below: Fixed: Is a charging scheme in which a fixed amount is collected towards web service usage.
Package: Is a charging scheme in which a fixed amount is collected towards web service usage. The time, content and functions would be specified as part of the package. However, users could be levied additional charges based on: Membership amount if charged could be paid on monthly, bi-monthly, quarterly, half-yearly or on an annual basis. Billing and Payment for members for usage of web services could be either pre-paid or post-paid.
Pre-paid: Users are required to pay a deposit amount in advance. The deposit amount is adjusted against web service usage. When the deposit amount is used up, then user would have to deposit additional amounts for the continuing use of the web services. Post-paid: Billing for services usage for members could be periodic with option for monthly, bi-monthly, quarterly and half-yearly or on annual basis as shown in Fig. 5.
Non members would have only payment and billing option on a pay-per-use basis. Pay-per-use is a charging strategy in which a user has access to potentially unlimited resources but only pays for what they actually use. Here again users could be charged based on web service usage time or on basis of content accessed as shown in Fig. 6. Additional charge could be levied for specific function usage. The credit card details would be collected from the users and their credit rating and limit would be verified prior to their use of the web services.

E-Book reading service case study:
We discuss the application of the generic charging policy for a sample E-book reading service. E-books are available for reading on-line and 4 books are displayed for reading. For every book, the title, author, publisher and year of publication would be displayed. The book ratings, for example, best seller, would be displayed with the book from various acknowledged sources. Users are also permitted to rate the book they have read on a scale of Must Read to Avoid. User ratings are also displayed to enable users to get an opinion of the books on display. The books displayed are changed every week and the old books are archived. The week starts on Saturday and ends on Friday. This is because it is assumed that readers would have more free time to read on Saturdays and Sundays and hence books are changed every Saturday.
Any user can access the web service. Users can choose to register and become members. A fee is charged towards membership. The member fee for different payment options is given in Table 1. Payment is given In Indian Rupees (INR). However, any currency could be used and this can be specified in the policy. The charging policy for membership fee is given in Table 2.
We first discuss the "Fixed" charging category. Users have to pay a fixed amount in addition to the membership fee. The amount payable would vary depending on the payment mode. Users can read any or all of the books displayed. They can log-in any time, 24/7 and read any of the books on display any number of times. They can choose to read from the beginning or from any required page or chapter. They would however not be permitted to download the books or read any of the books that have been archived. The fixed rates are given in Table 3 and the Charging Policy is given in Table 4. Table 3 gives the pricing options for fixed policy option. The payment modes and amounts are also given.
Many special options are available for members. For example, a list of books available would be displayed and the member would be able to ask for and read any books in the list. Members would also be able to place an order for any book of their choice. The book requested would be procured and made available to the member, if possible. The amount charged would depend on the number of request received and other aspects like publisher, book rating, date of release etc. Users may wish to download a certain "E-book" and may be charged a download fee for the book. Users could be permitted to read on-line for instance, one hour every day. Any additional reading time would be charged. Users could be permitted to read say 4 books per month. Reading of additional books would be charged. The above two are also examples of "Package" with the users being charged either on time basis or volume basis.          The rate for reading a book would be associated with the book and each book could have different reading charges based on their release date and popularity. Three different types of packages have been specified. However, any number of such packages can be added by the service provider as and when needed. Likewise, if a particular package is under used then the service provider can choose to withdraw the package. The package details are given in Table 5 and 6. A user can also create a personal package with options of their choice. A sample policy is given in Table 7. The user has opted the personal package of unlimited download option and unlimited accessing special books.
Set of users can form a group and decide on the package of their choice. The group usage charges would be calculated based on the options chosen, number of users and volume of expected transactions. Discounts will be offered to the group. For example, the membership charges for a month are Rs.100 for a single user and for a group of 10 users discount are offered and the membership charges will be Rs.700. A group should have a minimum of 5 members. The Group users opted for unlimited access of Archived and Special books. The group schemes are given in Table 8 and 9.
Non-member pricing policy scheme: Non members would have only payment and billing option on a payper-use basis. Pay-per-use is a charging strategy in which a user has access to potentially unlimited resources but only pays for what they actually use. Here again users would be charged based on web service usage time or on basis of content accessed as shown in Fig. 5. Additional charge could be levied for specific function usage. Users would be required to pay in advance before using the web services to ensure that payment is assured. A sample non-member policy scheme is given in Table 10.

MATERIALS AND METHODS
The details of pricing and charging for the usage of web service would be maintained in the AAA server. The providers of web services would use a Ws-Policy to express their service descriptions and charging rates and conditions. A user of service requester might query the policies of service providers to decide the service provider and appropriate web service. We present a tool for accepting the charging details from service providers and automating the creation of the Charging Policy. The tool has been created using J2EE and access as database and the policy would be created and stored in WS-Policy XML format. All data communications between the service providers and AAA server is carried out using SOAP protocol.
The service provider would first publish its web services in a Service Registry. Then the service provider would register with the AAA server. The service provider would then be able to create new charging policies for usage of their web service. We have created a tool to accept the web service and charging details and automatically create the charging policy using WS-Policy. The Sign-in screen is shown in Fig. 7.
New users can register themselves giving details like name of their company, address and other contact details. At the time of registration, they would have to pay for their membership and hence would have to provide their credit card details. The payment would be processed using a payment gateway and the registration would be accepted and confirmed if payment process is successful. Already registered users would be able to Sign-in directly. The registration and welcome screens are shown in Fig. 8 and 9.
Service Providers would be required to create a new policy for each web service that is to be charged. The details to be provided would include web service name, service registry name and the charging details. All policy schemes would need to include a validity date, that is, the date up to which the policy is valid. The service providers would have to pay a fee for creating and storing a policy in AAA server. The charging policy would be created as a WS-Policy by the tool and stored in AAA server. A sample charging policy for EBook reading service is shown in Fig. 10. The service provider would be able to view, modify and/or delete their policies. Charging schemes also specify the validity period. Any time, the provider can change their charging pattern and rates.

RESULTS
Through AAA server, the service consumer can discover service name, service provider, access rates and the registry in which the service is published. The users can access the WS-Policy of the service provider in the AAA server and retrieve the charging schemes and pricing. We have used Stylus Studio® X14 XML Enterprise Suite for the user to query the charging policy using XQuery. XQuery provides a powerful mechanism to access and manipulate data stored in XML documents. XQuery is a language that is used for finding and extracting elements and attributes from XML documents. It provides flexibility to query a XML information sources and defines a humanreadable syntax for that language. XQuery defines FLWOR expression named after its five clauses: for, let, where, order expression that supports iteration and binding of variables to intermediate results.

DISCUSSION
We explain the query facility using the on-line E-Book reading service. The policies given in the case study was implemented with 200 users in different charging categories. The reading service was implemented with two service providers "Provider1" and "Provider2". About 1000 books were available as archived books. Download and archive functions were implemented. The service was developed for a Windows 7 platform using J2EE. The usage details were stored in MS-accessdatabase. Exchange of policy information and other details was implemented using SOAP protocol. The query policy is explained with some sample queries.

Query 1: Providers offering E-Book Reading Service:
For $v in //Provider Order by $v/@name descending Return data ($v/@name) In this query, we used For, order and return clauses to know the providers offering E-Book Reading Service. This query returns the output of Providers offering E-Book Reading Service as shown in Fig. 11. Query 2: Charging Types offered by Provider1 for its members: The output of the query is given in Fig. 13. The Member Subscription amount for Package 3 offered by Provider1 is retreived and displayed.

CONCLUSION
Methods to provide flexibility in the accounting process have become of foremost importance for the commercial use of web services. Each service provider would like to have a unique charging and pricing methodology. We have presented a generic charging policy for web services that caters to different charging strategies and pricing patterns. We have explained the policy and its usage with a sample application. The users need to know the payment and pricing policy for web services, so as to enable them to decide on appropriate web services to suit their business needs and payment capabilities. Policies are expressed in WS-Policy and policy query facility has been developed using XQuery. As future work, we propose to further extend the charging policy to include charging based on Quality of service (QOS) and sharing of resources between multiple users. Other schemes like location based pricing or distance based pricing could be included to make the charging policy more varied and comprehensive.