API Platform Service Callouts using a Groovy Policy

Purpose The purpose of this post is to demonstrate through a practical example how a Developer might enrich an API payload using a Service Callout from within a Groovy Policy.   Background Since the release of Oracle API Platform v17.2.5, there has been a standard Policy entitled Service Callout 2.0 (version 1.0 having been deprecated […]

How to emulate 10g Adapter start/stop behaviour by manipulating the InboundThreadCount parameter

Introduction In 10g, there was a mechanism for suppressing consumption of messages at the Adapter level. That mechanism can not be used in 11g. But there is a way… Main Article The way to do this is to set the InboundThreadCount in the appropriate MBean to zero. This will effectively suppress consumption of messages – […]

A convenience method for closing multiple resources

Introduction Ensuring that resources (e.g. database connections) are properly closed to avoid leaks can make your code cumbersome. This article offers a simplification for this issue. Main Article As with all things Java, it’s often best to show by example. So that’s exactly what I’m going to do. The example that we’ll work with is […]

Considerations for optimum use of the Oracle Fusion Middleware File and FTP Adapters when acquiring files

Introduction Careful consideration needs to be given to the manner in which files are created and written for (read) processing by the File and FTP Adapters Main Article Note Hereinafter the term “the Adapter” means either the File or FTP Adapter. The abbreviation EA means External Application. General usage of the Adapter The objective of […]

Retrieve Performance Data from SOA Infrastructure Database

Here I would like offer examples of some basic SQL queries you can run against the infrastructure database of Oracle SOA Suite 11G to acquire the performance statistics for a given period of time. The final version of the script will prompt for the start and end time of the period of your interest.

2 way SSL between SOA and OSB

This blog describes all the steps to setup 2 way SSL between SOA and OSB.  The steps should be applicable if the external service is not hosted on OSB and other server with certain adjustment where appropriate.   

BAM design pointers

In working recently with a large Oracle customer on SOA and BAM, I discovered that some BAM best practices are not quite well known as I had always assumed ! There is a doc bug out to formally incorporate those learnings but here are a few notes..

 EMS-DO parity

When using EMS (Enterprise Message Source) as a BAM feed, the best practice is to use one EMS to write to one Data Object. There is a possibility of collisions and duplicates when multiple EMS write to the same row of a DO at the same time. This customer had 17 EMS writing to one DO at the same time. Every sensor in their BPEL process writes to one topic but the Topic was read by 1 EMS corresponding to one sensor. They then used XSL within BAM to transform the payload into the BAM DO format. And hence for a given BPEL instance, 17 sensors fired, populated 1 JMS topic, was consumed by 17 EMS which in turn wrote to 1 DataObject.(You can image what would happen for later versions of the application that needs to send more information to BAM !). 

We modified their design to use one Master XSL based on sensorname for all sensors relating to a DO- say Data Object ‘Orders’ and were able to thus reduce the 17 EMS to 1 with a master XSL.
 

For those of you wondering about how squeaky clean this design is, you are right ! This is indeed not squeaky clean and that brings us to yet another ‘inferred’ best practice. (I try very hard not to state the obvious in my blogs with the hope that everytime I blog, it is very useful but this one is an exception.)

Transformations and Calculations

It is optimal to do transformations within an engine like BPEL. Not only does this provide modelling ease with a nice GUI XSL mapper in JDeveloper, the XSL engine in BPEL is quite efficient at runtime as well. And so, doing XSL transformations in BAM is not quite prudent. 

The same is true for any non-trivial calculations as well. It is best to do all transformations,calcuations and sanitize the data in a BPEL or like layer and then send this to BAM (via JMS, WS etc.) This then delegates simply the function of report rendering and mechanics of real-time reporting to the Oracle BAM reporting tool which it is most suited to do.

All nulls are not created equal
Here is yet another possibly known fact but reiterated here.
For an EMS with an Upsert operation:
 
a) If Empty tags or tags with no value are sent like <Tag1/> or <Tag1></Tag1>, the DO will be overwritten with –null–
b) If Empty tags are suppressed ie not generated at all, the corresponding DO field will NOT be overwritten. The field will have whatever value existed previously. 
 
For an EMS with an Insert operation, both tags with an empty value and no tags result in –null– being written to the DO.
 

Hope this helps ..

Happy 4th!
 

Running Built-In Test Simulator with SOA Suite Healthcare 11g in PS4 and PS5

SOA Suite Healthcare Integration Pack provides a built-in utility to simulate an external endpoint for HL7 messaging flows. This lightweight, ant-based utility can be very useful to quickly simulate an endpoint for setting up round-trip HL7 messaging in a standalone, closed environment.

This note gives an overview about the setup and usage of the simulator utility. It also points out the differences that users have to keep in mind when migrating from PS4 to PS5 release.

11g purging white paper

Its finally released!!! The
11g white paper on purging is now readily available on OTN. This white
paper has been written by Michael Bousamra of Oracle SOA development
with contributions from me and Sai of SOA development. You can find the
11g whit…

How should I generate an external reference to a composite instance?

If you have a requirement to generate an external reference to an instance within SOA suite, how should one go about it? Which one of the values should you use?

Event Delivery Network (EDN) – A practical example

Details of how Oracle Event Delivery Network is used may be found here

A lower level description of EDN can be found here.

Using the TaskQueryService from .Net

This post demonstrates how to use the Human Workflow Services web services (specifically the TaskQueryService) from a C# .Net application.

READ MORE >>

List of all states from COMPOSITE_INSTANCE, CUBE_INSTANCE, DLV_MESSAGE tables

In many of my engagements I get asked repeatedly about the states of the composites in 11g and how to decipher them, especially when we are troubleshooting issues around purging. I have compiled a list of all the states from the COMPOSITE_INSTANCE, CUB…

Continuous Integration for SOA/BPM

 
We are hearing from a lot of customers that they are interested in applying Continuous Integration techniques to their Fusion Middleware environments.  The link below will take you to a series of posts about how to use Subversion, Maven a…

Using the Database as a Policy Store for SOA 11g

 
As more and more customers of SOA 11g move to production, we have been
asked often about the recommendations for a PolicyStore for SOA 11g in
production. This post addresses the various policy store options,
helps evaluate the pros and con…

Invoking web services dynamically in BPEL 1.1

This topic has been covered in postings that can be found at various locations. Your favourite search engine will reveal them to you.

Unfortunately, not all of these posts are up-to-date and some are just confusing. My intention here is to demonstrate a practical example from beginning to end using modern Oracle technologies. I have used JDeveloper 11.1.1.5.0 and Weblogic Server 10.3. I am assuming that the reader is familiar with JDeveloper, deploying to Weblogic and using the Weblogic Enterprise Manager (for testing purposes).

Before one can invoke a web service via its well-known endpoint, it is important to understand a significant restriction of this technique. Each web service must have identical message, port and namespace definitions. These need to be known at design time. So what’s the point of this? The benefit of this technique is that services located at different endpoints may be invoked based on runtime decisions (data driven). Indeed, the payload of the input message to the “driver” code [ see later ] may even contain the endpoint address. Thus, different functionality can be easily achieved by being able to invoke completely different services or perhaps just different versions of a service (providing the different versions are deployed and their endpoints are well known).

The development of this demonstration is strictly “bottom up”. We need to define our web service message structure. Implement and deploy the web service. “Clone” that service as many times as is necessary to give the number of services you need [ more detail later ]. We’ll just build 2 services.

Here’s the schema definition for our messages:-

<?xml version=”1.0″ encoding=”windows-1252″ ?>
<xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema
            xmlns=”http://www.oracle.com/ateam/dynamic
            targetNamespace=”http://www.oracle.com/ateam/dynamic
            elementFormDefault=”qualified”>
  <xsd:element name=”input”>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name=”Endpoint” type=”xsd:string”/>
        <xsd:element name=”parameter” type=”xsd:string”/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name=”output”>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name=”parameter” type=”xsd:string”/>
        <xsd:element name=”status” type=”xsd:string”/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

For the purposes of this example, we have an input message that contains Endpoint (being the endpoint of the service we intend to invoke) and parameter which is an arbitrary value that the service will “echo” to the invoker.

The output contains parameter (being the value that will be echoed) and status which will contain some value unique to the service.

So let’s start to design, build and deploy our project.

Create a new SOA application in JDeveloper and call it ATeamDynamic and specify an Application Package Prefix of your choice.

Name the Project Service_1 and we’ll start with an empty Composite.

Create an XML Schema Definition in the project’s xsd folder and call it common.xsd. Don’t worry about the namespace declaration because we’ll now overwite the xsd stub. Populate the schema with the xml shown above. Also, please note that for the sake of brevity we will use this schema for both the service(s) and the “driver” even though the Endpoint element is only significant in the driver process (i.e. not used by the service itself).

Drag a BPEL process onto the Composite canvas. Ensure that BPEL Spec’ 1.1 is checked. Name the BPEL activity as Process. Specify http://xmlns.oracle.com/ATeamDynamic/Service/Process as its namespace. Select Synchronous BPEL Process as the template. [ The service does not need to be synchronous for it to be usable dynamically but, obviously, the driver would have to be constructed differently if it was asynchronous ] The service name should read process_client.

Expose as a SOAP Service should be checked. Use the element browser to locate the input and output messages from the schema definition we created earlier.

Double-click the BPEL activity to go into the BPEL designer.

Drag an Assign activity onto the BPEL design canvas between the receive and reply activities.

Double-click the assign and do this:-

Assign activity

So all we’re doing is to copy (echo) the parameter value and set the status to “Service 1”.

Deploy the Project to Weblogic. In Enterprise Manager, test this service to ensure that it runs as expected. The tester will require an Endpoint value even though it’s not used. The parameter value should be echoed and the Status should indicate “Service 1”.

We will now create the second service. In JDeveloper, create a new SOA Project and name it Service_2. The procedure is exactly the same as for Service_1 except that we don’t need to create the xsd (we can re-use what we’ve already built) and in the BPEL Assign, we will copy the expression “Service 2” to the status element. Everything else is identical.

Now for the exciting part – the Dynamic Driver.

Create a new SOA Project and call it DynamicDriver and we’ll start with an empty Composite.

Drag a BPEL process onto the canvas. The name and namespace can be of your choosing. Use the Synchronous template for ease of testing. We will expose this as a SOAP service and use the same message types as before – i.e. from the common.xsd we created earlier.

Double-click the BPEL process.

Drag a PartnerLink Web Service Construct into the right-hand swim lane. The name can be anything of your choosing. We now need the deployed WSDL for one of the services we built / deployed earlier (it doesn’t matter which one). So, in the Create PartnerLink Wizard, we need to enter the WSDL URL. The easiest way to do this is to go back to the Enterprise Manager test page for Service_1 (or Service_2). On the test page you will see the WSDL query URL. It will look something like this:-

http://<hostname>:7001/soa-infra/services/default/Service_1/process_client_ep?WSDL

Copy and paste this URL into the Wizard. Click on PartnerLink Type. It will show as Process. Click on PartnerRole and select ProcessProvider. Click OK – i.e. leave My Role as “–Not Specified–“.

Drag an Invoke Construct onto the canvas between the receive and reply activities.. Connect the invoke to the PartnerLink. Create input and output variables as input and output respectively. [ I chose short generic names for brevity ]

We now need a new schema definition. We’ll start by creating a stub. Create a new schema definition in the xsd folder of the DynamicDriver project. Name it ws-addressing.xsd (although it could be called anything). Don’t worry about its content yet.

In your favourite browser, enter this URL http://schemas.xmlsoap.org/ws/2003/03/addressing/

This will reveal the ws-addressing schema that you need. Use your browser’s “view source” mechanism then copy and paste into your newly created ws-addressing.xsd

Now let’s go back to the BPEL Editor and we’ll create a new variable. Call it EndpointReference. Click the radio button labelled Element then browse for the EndpointReference element in the ws-addressing schema.

Drag an Assign construct onto the canvas immediately before the Invoke.

We now have to implement three copy activities within the Assign.

Firstly, copy this XML fragment into the EndpointReference variable:-

<EndpointReference xmlns=”http://schemas.xmlsoap.org/ws/2003/03/addressing” xmlns:ns1=”http://xmlns.oracle.com/AteamDynamic/Service/Process”><Address/><ServiceName>ns1:process_client_ep</ServiceName></EndpointReference>

Note that the ns1 namespace declaration and the ServiceName depend entirely on the developer having followed the naming conventions described herein.

We then need to copy the Endpoint part of the inputVariable to the Address part of the EndpointReference.

The third and final step for setting up the PartnerLink is simply to copy the EndpointReference to the PartnerLink. It should look like this:-

Endpoint assignment

Unusually, this may be easier to read in source mode thus:-

[ Please note that at deployment (build) time, a warning will be emitted concerning the 2nd copy because of a type mismatch. This is expected and may be ignored ]

Now we need to populate the payload for the Web Service itself thus:-

Assign5

The WS doesn’t use the Endpoint value but we need to copy something as the schema dictates that this element is mandatory.

After the Invoke, we’ll need to get the WS response like this:-

Assign6

Now we can deploy the DynamicDriver Project and test it.

In Enterprise Manager, start by selecting the Service_1 Project and then the Test tab. There you will see the endpoint URL for this service. Copy this URL.

Now select the DynamicDriver Project then the Test tab. Paste the Service_1 URL into the Endpoint field followed by some arbitrary text in the Parameter field. Click Test Web Service. If all is well, you will see the parameter value echoed and a status of “Service 1” indicating that the correct WS has been called.

Repeat the test for Service_2.

The complete Application is available here