Request Counter Interceptor Sample

Interceptor implementation is shown in Example 10, Request Counter Interceptor Class ; the configuration file is shown in Example 11, Request Counter Interceptor Configuration File . Page 540

3.3.3. Request Counter Interceptor Sample

Example 10. Request Counter Interceptor Class package interceptor; import org.idoox.config.Configurable; import org.idoox.wasp.WaspInternalException; import org.idoox.wasp.interceptor.InterceptorChain; import org.systinet.uddi.interceptor.RequestInterceptor; import org.systinet.uddi.interceptor.StopProcessingException; import java.lang.reflect.Method; public class RequestCounterInterceptor implements RequestInterceptor { private long request = 0; private RequestCounterInterceptorConfig.Counter counter; RequestCounterInterceptor config interface interface RequestCounterInterceptorConfig { public Counter getCounter; public void setCounterCounter counter; public Counter newCounter; interface Counter { public long getRequest; public void setRequestlong request; } } public void interceptMethod method, Object[] args, InterceptorChain chain, int position throws StopProcessingException, Exception { counter.setRequest++request; System.out.printlnrequest: + request; } public void loadConfigurable config throws WaspInternalException { RequestCounterInterceptorConfig intinterceptorConfig = RequestCounterInterceptorConfig config.narrowRequestCounterInterceptorConfig.class; if intinterceptorConfig = null { counter = intinterceptorConfig.getCounter; if counter == null { counter = intinterceptorConfig.newCounter; intinterceptorConfig.setCountercounter; } try { request = counter.getRequest; } catch Exception e { counter.setRequest0; } } Page 541

3.3.3. Request Counter Interceptor Sample

} Destroys the interceptor. public void destroy { no destroy required } } Example 11. Request Counter Interceptor Configuration File ?xml version=1.0 encoding=UTF-8? config name=myInterceptors UDDIInterceptorInstance className=interceptor.RequestCounterInterceptor instancePerCall=false name=RequestCounterInterceptorSampleInstance UDDIInterceptorInstance UDDIInterceptor fault=false instanceName=RequestCounterInterceptorSampleInstance interceptorChain=inquiry_v3 name=RequestCounter request=true response=false config

3.4. Writing a Custom Validation Service

Oracle Service Registry provides several ways to define and use validation services for taxonomies or identifier systems. For details about Oracle Service Registry taxonomies, please see Users Guide, Section 5.4, Taxonomy: Principles, Creation and Validation . This chapter focuses on custom validation services that you can deploy: • Locally on Oracle Service Registry - Local validation service. • Remotely to a SOAP server, for example the Systinet Server for Java - External validation service. There are three different Java interfaces for validation services, one for each of the main UDDI data structures. These interfaces correspond to the WSDL Port Types of the Validation Service defined in the UDDI specification. • U D D I v 3 v a l i d a t i o n s e r v i c e s m u s t i m p l e m e n t org.systinet.uddi.client.valueset.validation.v3.UDDI_ValueSetValidation_PortType . • UDDI v2 validation services must implement org.systinet.uddi.client.vv.v2.ValidateValues . • UDDI v1 validation services must implement org.systinet.uddi.client.vv.v1.ValidateValues . These interfaces are similar enough that we will only describe v3 validation. Your validation service must implement the interface UDDI_ValueSetValidation_PortType. This interface only has the validate_values method which has only one parameter, Validate_values. This parameter is a wrapper for real parameters: optional authInfo and basic UDDI data structures businessEntities, businessServices, bindingTemplates, tModels and publisherAssertions to validate. The validate_values method returns org.systinet.uddi.client.v3.struct.DispositionReport . If validation passes successfully, the DispositionReport should contain only one org.systinet.uddi.client.v3.struct.Result with errNo equals org.systinet.uddi.client.UDDIErrorCodes .

3.4.1. Deploying Validation Service

Once the validation service is implemented, you can deploy the validation service locally on Oracle Service Registry. To deploy the validation service on Oracle Service Registry Page 542

3.4.1. Deploying Validation Service

1. Create a classes subdirectory under REGISTRY_HOMEappuddiservicesWASP-INF and copy the class file into this directory with respect to subdirectories corresponding to packages. 2. Shutdown Oracle Service Registry, delete the REGISTRYwork directory, and restart Oracle Service Registry. For more information, please see the Demos, Section 2.4, Validation . For details about the configuration of Validation Services, please see Administrators Guide, Section 1.5, Taxonomy Management To deploy an external validation service, you must create a deployment package.

3.4.2. External Validation Service

This section shows you how to implement and package an external validation service that will be deployed to Systinet Server for Java. We show you how to package and deploy the ISBN validation service from the validation demo described in Section 2.4, Validation . We assume you have already built the Validation demo. Note We also assume Oracle Service Registry is installed in the REGISTRY_HOME folder and running at http:localhost:8888registry and that Systinet Server for Java is installed in WASP_HOME folder and running at http:localhost:6060 To package and deploy a validation service to Systinet Server for Java: 1. Create a deployment package. Create the jar file ExampleValidation.jar with the following structure: Copy ISBNValidation.class from REGISTRY_HOMEdemosadvancedvalidationbuildclasses to the package. Copy the wsdl and xsd files from REGISTRY_HOMEdocwsdl to the package. Copy the package.xml file shown at Example 12, package.xml to the package. 2. Deploy the validation package with required Oracle Service Registry client packages into Systinet Server for Java. a. copy REGISTRY_HOME\dist\uddiclient_api_v3.jar WASP_HOME\app\system\uddi b. copy REGISTRY_HOME\dist\uddiclient_value_set_validation_v3.jar WASP_HOME\app\system\uddi Page 543

3.4.2. External Validation Service