SOA Suite 12c – Create, Deploy, Attach and Configure a Custom OWSM Policy – to report on service execution by Lucas Jellema
By Juergenkress-Oracle on Aug 24, 2015
This article describes how to develop a straightforward custom assertion that can be used as part of custom OWSM policy to be attached to Web Services in WebLogic, such as services exposed by SOA Composite applications and Service Bus projects as well as custom JAX-WS or ADF BC Web Services. The custom assertion that I demonstrate here reports the execution of web service operations to a JMS Destination and/or the system output. It shows how to access property values set on the policy binding (values specific for the service the policy is attached to) and how to inspect the headers and contents of the request and response messages. Most custom assertions will use a subset of the mechanisms shown in this example. As always, the source code is available for download. Note: this article was edited on April 6th to reflect better code structure.
Custom assertions can be used in policies that are applied to web services. Depending on the type and configuration of the policy and assertions, they can be triggered at different moments and perform different tasks. These assertions are similar to aspects (in AOP) that take care of cross cutting concerns and that do not interfere with the internals of a service. Policies are attached (and detached) at runtime by the administrators. The assertion discussed in this article is to be attached to the service binding at the inbound end of a SOA composite application (or at a Service Bus proxy service that serves the same purpose). The assertion will report every incoming request as well as each response returned from the service binding. This information can be leveraged outside the scope of this article to monitor the runtime service environment.
The steps describes in this article in the process of creating and putting into action the custom assertion are:
- Create Custom Policy:
- Assertion Java Class
- Policy XML File
- Policy Configuration XML File
- Deploy Policy Artifacts to Runtime Fusion Middleware platform (and restart the WebLogic Servers)
- Import Policy Definition into Runtime Fusion Middleware platform
- Attach the Policy to a Service Binding in an existing SOA Composite application and configure the policy binding properties
- Invoke the service exposed by the [Service Binding in the existing] SOA Composite application
- Verify the results produced by the policy attachment
Create the Custom Policy
main part of the custom assertion definition is a Java class. See for
details the sources that can be downloaded from GitHub.The project
contains a helper class – CustomAssertion – that takes care of some
generic plumbing that are required for the AssertionExecutor superclass
that needs to be extended. The class SOASuiteServiceExecutionReporter
contains the custom logic that is to be executed whenever the policy
assertion is triggered. In the current case, this logic consists of
retrieving some key elements about the service request – service name,
operation name, ECID, timestamp and selected payload details – and
reporting them. Initially, this report consists of a few lines in the
system output (i.e. the domain log file). Later on, we will send the
report to a JMS destination. Read the complete article here.
For regular information on Oracle SOA Suite become a member in the SOA & BPM Partner Community for registration please visit www.oracle.com/goto/emea/soa (OPN account required) If you need support with your account please contact the Oracle Partner Business Center.