WebSphere brand IBM WebSphere Telecom Web Services Server, Version 7.1

Web service integration

Using a Web service interface called ServicePolicyAccess, you can expose the Service Policy Manager (or a custom-developed alternative) as a Web service that can be used by applications to retrieve service policies.

Using ServicePolicyAccess

Telecom Web Services Server provides the Service Policy Manager component, which uses a Web service interface to access the policies. (The Access Gateway component references the ServicePolicyAccess interface to call the getServicePolicies operation.)

You have the option of replacing the Service Policy Manager with your own custom-developed alternative. Start with the WSDL for ServicePolicyAccess and create your own implementation of the Web service interface. For more information, refer to the topic WSDL documentation for WebSphere Telecom Web Services Server.

General integration capabilities

The Service Policy Manager component provides both a Web service interface and a user interface that allows scripting through JMX and wsadmin, using such languages as Jython or Python.

The Web service interface is divided into two different application programming interfaces (APIs):
  • Access interface
  • Administrative interfaces

These capabilities are exposed through remotely accessible interfaces. The runtime exposes two sets of interfaces: an access interface that is used to retrieve policy information for a given requester, service, and operation, along with a set of administrative interfaces that allows for the management of requesters, services, subscriptions, data types, and policy values.

The Service Policy Manager resolves policy values using a hierarchical algorithm; requesters and services can be organized into a tree hierarchy that allows for groupings of requesters and services. Both subscriptions and policies can then be set within the tree scope. The lookup process is hierarchical, allowing requesters and services that are lower in the tree to inherit subscriptions and policy values from their parents. The console builds on top of the runtime to provide graphical portlet capabilities for managing service policy manager entities. The console can be deployed either standalone or within a full portal runtime.

The Web service admin scripting is the preferred bulk loading or initializing process of the Service Policy Manager. This allows for administering Service Policy Manager definitions from the command-line interface using scripting, or a JMX browser for discovery. Additionally, JMX can be used for discovery purposes to determine whether the Service Policy Manager has been deployed in the same WebSphere® Application Server installation.

Using wsadmin scripting in Jython mode is recommended. The following topics in the WebSphere Application Server information center provide a good overview for how to use wsadmin scripting. Both are located within the major topic Scripting the application serving environment (wsadmin).
  • Getting started with scripting, which has subtopics for using the wsadmin scripting objects and starting the wsadmin scripting client
  • Scripting and command line reference material

Example: Accessing the RequesterAdministration MBean

The following is an example of Jython code that accesses the RequesterAdministration MBean to perform a query:

$ ./wsadmin.sh –lang jython
mbean_list = AdminControl.queryMBeans(“type=RequesterAdministration,*”) length = mbean_list.size() 
if length > 0:
inst = mbean_list[0]
# Just use the first one returned
obj_name = str(inst.getObjectName())
# Print out all attributes
print AdminControl.getAttributes(obj_name, None)

Example: Accessing the PolicyAdministration MBean

The following is an example of Jython code that accesses the PolicyAdministration MBean to update a policy:

$ ./wsadmin.sh -lang jython -f polinit.py

import sys.argv
import getopt
from com.ibm.twss.spm.admin.common import ScopedPolicy
from com.ibm.twss.spm.admin.common import PolicyValue
from java.util import Properties

from pytwss.mbean import spm_init, mbean_utils
from pytwss.utils import _, log

A_SERVICE = 'http://www.csapi.org/wsdl/parlayx/A/v2_3/interface'
SVC_GROUP = 'AService'
SERVICE_IMPL = 'PX21_A_PARLAY'

def configurePolicies(response_properties):
	req_scope = 'ALL'
	svc_scope = SVC_GROUP
	op_scope = 'ALL'

	svc_admin = spm_init.ServiceAdministration()
	policy_admin = spm_init.PolicyAdministration()

	spm_init.registerServiceImplementation(
		svc_admin, A_SERVICE, SERVICE_IMPL, 1,
		'AService description')

        sp_root_url = response_properties.get("ServicePlatformRootURL")

	policies = [
		ScopedPolicy(
			requesterIdentifier=req_scope,
			serviceIdentifier=svc_scope,
			operation=op_scope,
			name='service.config.StatusRetainTime',
			value=PolicyValue(
				value='2000',
				type='Numeric'
			)
		),
		ScopedPolicy(
			requesterIdentifier=req_scope,
			serviceIdentifier=SERVICE_IMPL,
			operation=op_scope,
			name='service.Endpoint',
			value=PolicyValue(
				value=sp_root_url + "/TWSS/ParlayX21/AService/Parlay/services/AService",
				type='String'
			),
		),
	]
	spm_init.createPolicies(policy_admin, policies)
        
        return "SUCCESS";

if __name__ == 'main':
   if len(sys.argv) > 0:
      sp_path = sys.argv[0]
   else:
      sp_path = "http://localhost:9080/"
   p = Properties()
   p.put("ServicePlatformRootURL", sp_path)
   configurePolicies(p)



Terms of use
(C) Copyright IBM Corporation 2009. All Rights Reserved.