Tuesday, December 6, 2011

SOAP Version Mismatch Exception in SOA 11g

Recently one of the queries that was posted in the practice forum was regarding the SOAP version mismatch

Facing the below exception in client environment when an external client is invoking bpel service deployed on SOA Suite

oracle.j2ee.ws.saaj.soap.SOAPVersionMismatchException: Mime Header Content-Type: text/xml requires SOAP envelope namespace: http://schemas.xmlsoap.org/soap/envelope/: Mime Header Content-Type: text/xml requires SOAP envelope namespace: http://schemas.xmlsoap.org/soap/envelope/

They tried the option of generating SOAP1.2 binding in the wsdl (i.e., open the wsdl in design mode and drag the ‘binding’ component on to the centre pallete, and choose the option of SOAP 1.2) and the WSDL file will have the namespace like http://schemas.xmlsoap.org/soap12/ which is still different from the namespace client is sending.

1.    When the SOAP 1.2 generated wsdl is opened in browser, only SOAP 1.1 namespace is visible. Is the SOA suite overriding SOAP 1.2 with 1.1? How do we enforce SOA suite to use SOAP1.2 namespace?

 The problem is due to version mismatch Client is expecting a SOAP 1.2 service where as we are exposing a SOAP 1.1 service. By default the Jdev created BPEL service will be using SOAP 1.1 .The way to change it is to mention a soap version as part of the service in composite.xml

In composite.xml, add the soap version for the exposed service and redeploy, it will start using SOAP 1.2 bindings. By default if soap version is not specified it uses soap 1.1.

sample code snippet of Composite,xml
<service name="bpeltest1_client_ep" ui:wsdlLocation="BPELTest1.wsdl">

Hope this helps in resolving the version mismatch issues accessing SCA composite services.

Tuesday, October 4, 2011

Human Workflow - with multiple callbacks

In one of my discussions with a customer, there was a query regarding the Human workflow and the flow of control between different activities. They wanted to know how the BPEL service and Workflow service interacts with each other. If you see the InitiateTask operation it is a synchronous operation which calls the workflow service and passes the payload and task attributes and gets the control back to BPEL process.
In case of a basic flow the initiate task is executed, workflow service instance is created and service waits in queue of user to be approved/rejected or complete an outcome. Where as in BPEL the control returns after initiateTask invocation, but the next activity is a receive callback from Workflow service which will only trigger once the user completes his action. So the BPEL process instance gets dehydrated and waits for action.
In case of designing an advanced flow with multiple callbacks, the BPEL generates extra code to handle multiple operation updates that happen from the workflow service. The workflow service will run as an independent process flow which has java API calls to invoke the callback operations defined in the TaskService wsdl  to give back control to BPEL after different task stages. In BPEL, the flow goes into a while loop waiting for a callback from the workflow service. The Pick activity as shown below will be looking for onMessage from ->OnTaskCompleted,OnTaskAssigned,OnTaskUpdated and OnSubTaskUpdated.
  • onTaskCompleted — This callback is invoked when the task is completed, expired, withdrawn, or errored.
  • onTaskAssigned — This callback is invoked when the task is assigned to a new set of assignees due to the following actions:
    • Outcome update
    • Skip current assignment
    • Override routing slip
  • onTaskUpdated — This callback is invoked for any other update to the task that does not fall in the onTaskComplete or onTaskAssigned callback. This includes updates on tasks due to request for information, submit information, escalation, reassign, and so on.
  • onSubTaskUpdated — This callback is invoked for any update to a subtask.
 To go to advanced mode, select the Allow task and routing customizations in BPEL callbacks check box. This  will enable the workflow service to  notify the BPEL process using OnMessage callbacks every time a task is routed to a different user or when the task status changes
Coming to my customer requirements, they wanted to be notified incase the task is reassigned for more than 3 times .In case of a reassign the OnTaskUpdated  callback will be invoked and control will get into the OnTaskUpdated  parallel flow where you can add the required customizations.. So this logic was embedded in this callback flow. After the flow is completed it again goes back and waits in the while loop till next callback event is activated from the workflow service.
The figure defines the human workflow process flow inside the BPEL. The while loop enables the BPEL process instance to wait on pick activity till the task status gets updated to task completion/expiration/error/stale/withdrawn. This brings in multiple options for customization within the BPEL based on the workflow status/updates. This is really good feature using multiple callbacks functionality.

Friday, September 16, 2011

Weblogic:Classloading and Classloader Analysis Tool

There is a Classloading Analysis Tool(CAT) provided in Weblogic server(PS3) which helps you to monitor the class loading pattern that happens with an application. It helps you in identifying any class loading issues that can happen due to different java classes that are duplicated with different libraries. To understand the use of CAT, you should first know the class loading pattern in Weblogic.
Classloading in Weblogic happens in different levels.The below image shows the hierarchy in which the class loading happens
System classloader is the top-level classloader that loads the WebLogic implementation classes and supporting libraries defined on the classpath (those added to setDomanEnv and commEnv) 
Domain level classloader is a child to the SYSTEM classloader and loads libraries that are included in the domain lib directory.
Application level classloader is the next in order.  WebLogic Server automatically creates a hierarchy of classloaders when an application is deployed. The root classloader in this hierarchy is the APPLICATION classloader and it loads modules defined in the application, including EJBs, as well as java EE shared libraries and libraries included in the configured library directories for the application.
For each web application, a child class loader is created and it loads the shared Java EE libraries as well as the libraries and compiled classes in the WEB-INF folder.

What happens if the CAT find issues in the class loading pattern of the application
WebLogic has  a feature called the Filtering ClassLoader which overrides the TOP-DOWN classloading and essentially enables child-first classloading.  When filter is enabled, priority is given to the resources from the child of the FilteringClassLoader (an application classloader) before the ones from the system classloader . This will be mainly used when the version used by systme class loader or top level class loaders are different from the one required by the application.
Usage(in weblogic.xml)

How to use  CAT?
Login to http://host:port/wls-cat/ and enter your credentials.

- Analyze classloading conflicts
- View the system and application classloaders
- Generate reports

CAT will suggest you solutions to overcome the conflicts which is also a good feature.
Below references give you detailed explanation on weblogic class loading as well as fetures involved in CAT tool.
  1. CAT tool
  2. Class Loading by Jeff West

Tuesday, August 23, 2011

Advanced Weblogic Scripting(WLST) with Record functionality

            Weblogic Console has been a really good tool for administrating all server related configurations. One of the innovative features I liked in weblogic console was the Record option. It’s an amazing utility that allows us to capture the steps involved in server configuration. The recording gets stored as a collection of WLST commands that got executed behind the scenes in a python script file.
The Recording option can be made automatic based on the Preferences. It starts recording when you obtain a lock on the domain configuration and stops recording when you activate your changes, undo your changes, release the lock, or lose the lock. This feature is not available when "Automatically Acquire Lock and Activate Changes" (under "User Preferences") is enabled. When this is disabled we can have the manual Record option.

Here I will show you the WLST script that gets generated when we create a datasource.
Recorded Script


set('JNDINames',jarray.array([String('jdbc/TestDS1')], String))

setEncrypted('Password', 'Password_1314091630125', 'C:/ Oracle/Middleware/SOA11gPS3/user_projects/domains/soa_domain/Script1314091383906Config', 'C:/Oracle/Middleware/SOA11gPS3/user_projects/domains/soa_domain/Script1314091383906Secret')

cmo.setTestTableName('SQL SELECT 1 FROM DUAL\r\n\r\n')




set('Targets',jarray.array([], ObjectName))


Modified  Script - Parameterized

wlURL = raw_input('Enter server URL:')
wlUserName = raw_input('Enter weblogic username:')
wlPassword = raw_input('Enter weblogic password:')
dsName = raw_input('Enter JDBC resource name:')
jndiName = raw_input('Enter JDBC JNDI name:')
dbURL = raw_input('Enter JDBC DB url:')
dsUsername= raw_input('Enter DB username:')
dsPassword=raw_input('Enter DB password:')

connect(wlUserName, wlPassword, wlURL)



set('JNDINames',jarray.array([String(jndiName)], String))


cmo.setTestTableName('SQL SELECT 1 FROM DUAL\r\n\r\n')




set('Targets',jarray.array([], ObjectName))


How to run the script
  1. Go to the Domain bin folder and run setDomainEnv.sh script
  2. Run  >> java weblogic.WLST  /tmp/geo/CreateDataSourceScript.py

Execution StackTrace
>>>java weblogic.WLST D:\CreateDataSourceScript.py

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Enter server URL:t3://localhost:7001
Enter weblogic username:weblogic
Enter weblogic password:welcome1
Enter JDBC resource name:TestDS4
Enter JDBC JNDI name:jdbc/TestDS4
Enter JDBC DB url:jdbc:oracle:thin:@localhost:1521:XE
Enter DB username:DEV_TestDB
Enter DB password:welcome1
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'soa_domain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

Location changed to edit tree. This is a writable tree with
DomainMBean as the root. To make changes you will need to start
an edit session via startEdit().

For more help, use help(edit)
You already have an edit session in progress and hence WLST will
continue with your edit session.

Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released
once the activation is completed.
Activation completed

That’s it for today. thanks to below references.
  1. Advanced WebLogic Scripting with WLST: Recording, Editing and Reusing
  2. Using the Console to Create Repeatable Configuration Scripts

Wednesday, August 17, 2011

Capturing Business Events @Oracle BPM 11g

        This blog will be the first in series of blogs I will be writing on Oracle BPM suite. In this blog I will look at different options available in Oracle BPM for tracking and monitoring the business process. So how do we get started on monitoring part? In BPEL we used to have sensors and it can be monitored on BAM dashboards, AIA had audit logging mechanisms which we had to invoke to get the information logged. In BPM we have BAM Data Objects as well as BPM Process Cubes. So what/how do we feed these monitoring mechanisms? That’s what we will be focusing on in this blog.

Capturing the business events
To get started with this the analyst need to follow the below steps
  1.     Identify KPI’s and process metrics
  2.  Create Business indicators to capture metrics
  3.    Identifying Sampling points for capturing business indicators
  4.   Enable publishing using BAM  or BPM Process Cubes
  5.    Validate and deploy
  I will be focusing on the initial 3 steps, as step 4 is on enabling the BAM Data objects and BPM Process cubes, step5 on deployment.
1.    Identify KPI’s and process metrics
First step will be to identify the KPI’s and process metrics. KPI’s help an organization define and measure progress toward organizational goals. They are quantifiable measurements, agreed to beforehand, that reflect the critical success factors of an organization. Process metrics are measurements of the steps of a process. Steps generally have completion milestones, and processes are generally measurable in business terms such as timeliness and cost. 

2.    Create Business indicators to capture metrics
Business Indicators are project data objects that are used to store the value of the KPI’s of your process. i.e they can store the value of an indicator you want to measure in your process. Oracle BPM gives you 3 options to define business indicators, and it needs to chosen based on the information type of the value.
a.    Dimension
It defines specify how the data need to be picked. Dimension store the value of a KPI that you can use to group the values of the measure business indicators in your process.
b.    Measure
Measure will help you capture numerical data which signifies a value which will help you in analytics
c.    Counters
Counters are type of measures used for no.of occurrence, keeps track of the number of times an instance completes a certain activity

3.    Identifying Sampling Points for capturing business indicators
                At runtime when the BPMN Service Engine runs the activity in the process it stores data about the process to the BPM Cubes and Oracle BAM Data Objects. This data comes from the sampling points defined in the project.
          Sampling points are broadly divided into two.
 a.    Build-in Sampling Point
-          configured  at project, process and activity level
o    generate sampling for all user tasks
o    generate sampling for start/end of process
o    generate sampling for start/end of activity
-          Dimensions are always captured
-          Sampling point settings can be overridden at different levels.

b.     User defined Sampling Point
- Measurement marks
Measurement marks store the following data into the Process Analytics databases:
      • The value of the process default measures
      • The value of the measure business indicators associated to that measurement mark
      • The value of the dimensions defined in the process

(i)    Single Measurement
To sample business indicators at a specific point in process
(ii)   Counter Mark
It is used to track the number of times the instance runs the particular activity
(iii)                Interval(start & end)
This will measure a business indicator in a section of your process Always use these measurement marks to monitor critical sections of your process
 What Happens @ Measurement Marks
The BPMN Service Engine stores the values of the measure business indicators associated with the pair of measurement marks to the Process Analytics databases. It also stores the values for the dimensions and default measures for that process section.
That’s pretty much for today on the capturing of business events in BPM.