Sunday, August 26, 2012

BAM 11g - Configuration of EMS (Enterprise Message Source) in BAM

Enterprise Message Sources (EMS) is used by applications to provide direct Java Message Service (JMS) connectivity to the Oracle BAM Server. Each EMS connects to a specific JMS topic or queue, and the information is delivered into a data object in the Oracle BAM Active Data Cache.

In this Post I will explain you step by step process to configure EMS in BAM.

Step 1: First we need to have JMS queue. So let’s create a JMS queue first.

Go To EM console http://host:port/em


Go To services -> Messaging -> JMS Module -> Choose module under which you want to create JMS Queue(SOAJMSModule) -> New -> Choose Queue

Create JMS Queue


  • Let’s create one queue with name BamQueueTesting
    Queue Name- BamQueueTesting
    JNDI – jms/ BamQueueTesting
Enter JMS Queue Details
Step 2: Now create a new connection Factory.

Go To services -> Messaging -> JMS Module -> Choose module under which you want to create JMS Queue(SOAJMSModule) -> New -> Choose “Connection Factory”

Creat Connection Factory
  • Enter following values for Connection Factory.
        Name – BamQueueTestingCF
        JNDI – jms/BamQueueTestingCF

Add Connection Factory Details

Step 3: Now we will configure EMS in BAM, but before that we need to have Data Object in Bam, so let’s first create Data Object. Go through my Previous Post that explains how to create Data Object in BAM.
We created “BamQueueDataObject” in BAM having below fields.

o   Name
o   ID
o   Address
o   Marks
o   MaxMarks

Step 4: Now Configure EMS.


Choose “Enterprise Message Source” from drop down list and click on create button.

Create EMS
  • Now we need to fill following details.
Fill EMS Details


  • Start entering following details
    o   Name- BamTestQueue (It can be anything as per your requirement and naming standards)
    o   Intial Context Factory- weblogic.jndi.WLInitialContextFactory (Leave it as default)
    o   JNDI Server Provider URL – t3://host:port (t3://localhost:8001)
    Since we created the JMS queue which is targeted to SOA server, so here soa server port will come.
    o   Queue Connection Factory Name- jms/BamQueueTestingCF (JNDI of Connection Factory)
    o   Queue Name – jms/BamQueueTesting (JNDI of Queue)
    o   Data Object Name – Click on Browse and choose the DO which we created earlier.
    o   Operation - Insert

Fill JMS Queue Details
  • Now we will map message in the Queue to Data Object. We will get following message in JMS Queue.
    <?xml version="1.0" encoding="UTF-8" ?>
    <process xmlns:client="http://xmlns.oracle.com/TestApplication_jws/BamQueuTesting/BamQueue" xmlns="http://xmlns.oracle.com/TestApplication_jws/BamQueuTesting/BamQueue">
       <client:Name>test</client:Name>
       <client:ID>89</client:ID>
       <client:Address>mumba</client:Address>
       <client:Marks>99</client:Marks>
       <client:MaxMarks>100</client:MaxMarks>
    </process>

    o   Message Element Name – process (This is root element of the message that we will get in JMS Queue)
    o   Check “Namespace Qualified”
    o   Namespace URI - http://xmlns.oracle.com/TestApplication_jws/BamQueuTesting/BamQueue
    o   Check “Element Tag” as we need to map need Elements in Message in JMS queue to fields in Data Object.

Map Fields

Step 4: Now we are ready for testing. Start the EMS that we created just now and put one message in Queue.

Message in Queue.

<?xml version="1.0" encoding="UTF-8" ?>
<process xmlns:client="http://xmlns.oracle.com/TestApplication_jws/BamQueuTesting/BamQueue" xmlns="http://xmlns.oracle.com/TestApplication_jws/BamQueuTesting/BamQueue">
<client:Name>test</client:Name>
<client:ID>89</client:ID>
<client:Address>mumba</client:Address>
<client:Marks>99</client:Marks>
<client:MaxMarks>100</client:MaxMarks>
</process>

You can see same data in Data Object.

o   Start mapping Data Object fields.

o   Check “Log faulted Message” in case you need to log the message if any error occurs.

EMS Testing


Go Through my previous post which explain how to create Data Object In BAM.






Saturday, August 25, 2012

BAM 11g - Create Data Object

Data objects are tables that store raw data in the database. Each data object has a specific layout which can be a combination of data fields, lookup fields, and calculated fields.Whenever we are connecting to BAM we are sending data to Data Objects.

Below is step by step process to create Data Object.

- Go to BAM Console http://host:port/oraclebam 
- Click on Architect 

Bam Console

- From Drop down select "Data Object"

Choose Data Object


- Click on "Create subfolder" if you want to create Data Object in different folder. Or you can choose any exiting folder.

Create Sub Folder

- We will create Data Object inside "TestDataObject" subfolder that we created above.


- Click on "Create Data Object" to create new Data Object.

Create Data Object Link

- Enter Data Object Name, Tip text and Description as per your requirement. Click on "Add a field" link to start adding new fields to newly created Data Object.

Enter Data Object Details


- Add Required fields in Data Object and click on "Create Data Object" button to complete Data Object creation process.

Add Data Object Fields


- Click on Continue.

Complete Data Object Creation


- Data Object successfully created.

Data Object Creation Completed


Next Post explains How to Configure/Create EMS (Enterprise Message Source) in BAM

Create EMS in BAM




OSB 11g - Call Asynchronous SOA service from OSB using soa-direct protocol

In my previous post I explained how to call Synchronous SOA service from Oracle Service Bus using soa-direct protocol. In this post I will explain you how to call Asynchronous SOA service from Oracle Service Bus.

OSB to SOA Call using soa-direct


Only difference between Synchronous and Asynchronous call is, in case of Asynchronous call we need to created extra “Call Back Proxy Service” which gets the response back from Asynchronous SOA service.

First of all we need to have Asynchronous web service. I created one Asynchronous BPEL process that we will invoke from Oracle Service Bus.

In this post, we will use “soa-directOSB protocol to connect to Asynchronous SOA service. For this one you need to use Direct Binding in Asynchronous web service instead of default binding. To change the binding go to Composite.xml and comment out binding.ws part inside service tag.


Original service tag
<service name="asynchronousbpelprocess_client_ep"
           ui:wsdlLocation="AsynchronousBPELProcess.wsdl">
    <interface.wsdl interface="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.interface(AsynchronousBPELProcess)"
                    callbackInterface="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.interface(AsynchronousBPELProcessCallback)"/>
    <binding.ws port="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.endpoint(asynchronousbpelprocess_client_ep/AsynchronousBPELProcess_pt)"/>
    <callback>
      <binding.ws port="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.endpoint(asynchronousbpelprocess_client_ep/AsynchronousBPELProcessCallback_pt)"/>
    </callback>
  </service>

Service tag with Direct Binding

<service name="asynchronousbpelprocess_client_ep"
           ui:wsdlLocation="AsynchronousBPELProcess.wsdl">
    <interface.wsdl interface="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.interface(AsynchronousBPELProcess)"
                    callbackInterface="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.interface(AsynchronousBPELProcessCallback)"/>
    <binding.direct/>
  </service>


Since we added Direct Binding in comspoite.xml file so you can’t get WSDL and Schema files directly from EM console. To get the WSDL and schema file go to http://host:8001/soa-infra/ login with your credentials and select your deployed service and save WSDL and schema files.

Step 1: Create a new OSB project and import Asynchronous web service WSDL and import as I mentioned in previous post also. See previous Post Step 1 for details steps.

New OSB Project

Step 2: Before creating Business service, we require Call Back proxy service that we will use in business service.
  • Click on “proxy” folder and choose “Proxy Service” as “Select Resource Type” from Create Drop down list.
  • Give it any name and choose “WSDL Web Service” as Service Type. Click on Browse button and select previously imported WSDL file.
Call Back Proxy Creation
  • Choose AsynchronousBPELProcessCallBackDirectBinding1.2 from Bindings and click Submit. Then click on Next button.
                          choose call back direct binding
  • Choose “sb” protocol and click next.

choose sb protocol
  • Accept default values and we have call back proxy service ready. Now we can move to Business service creation.
Call Back proxy service

Step 3: In this step we will create Business Service based on Asynchronous web service WSDL file.
  •       Click on “business” folder and choose “Business Service” as “Select Resource Type” from Create Drop down list.
  •      Give it any name and choose “WSDL Web Service” as Service Type. Click on Browse button and select previously imported WSDL file.
Business Service Creation
  •      Select “AsynchronousBPELProcessDirectBinding1.2” from WSDL definitions. Click Submit and then go to Next step.
choose direct binding for business service
  •      Choose “soa-direct” protocol and check server host and port in Endpoint URI and click on Add button. Then click on Next button.
t3://localhost:8001/default/AsynchronousComposite!1.0/asynchronousbpelprocess_client_ep
Where t3 is protocol, 8001 is port for soa server, default is web logic domain,                      AsynchronousComposite!1.0 is name of composite with version ( project), asynchronousbpelprocess_client_ep  is name of the service tag inside wsdl file.

                                           or

You can take "Endpoint URI" from "location" attribute under <Service> tag of AsynchronousComposite Wsdl file.
                            add endpoints
  •      Select “Asynchronous client” as Role. Then browse for Call Back proxy service and choose previously created Call Back proxy service.
choose call back proxy
  •      Accept Default values and you are ready with Business service.
Business Service

Step 4: Now we will create Proxy service that will invoke Business service that we just created.
  •      Click on “proxy” folder and choose “Proxy Service” as “Select Resource Type” from Create Drop down list.
  •      Give it any name and choose “WSDL Web Service” as Service Type. Click on Browse button and select previously asynchronous web service WSDL file.
  •      Select Direct Binding port. Accept Default values.
  •      Now we are ready with Client proxy service.

Step 4: Only step remaining is to connect Client proxy service to Business Service.
  •      Go to Client proxy Service Message flow.
Message Flow
  •      Add Route Activity to proxy service flow to call Business Service. You can edit the name of the route activity.
add route node
  •     Now Go to Edit Route.
edit route node
  •      Add a new Action “Routing” inside Route Node.
add routing action
  •      Choose Business Service. And choose operation for the Business Service.
call business service

This is it. Now we are ready to test it.

Testing Scenario: From Outside we will invoke Client Proxy service then Client proxy service will invoke Business Service which in turn calls Asynchronous web service. Asynchronous will process the message and send the response back asynchronously. Call back proxy catch that response and we can do  whatever we want to do there.

Go through my previous Post




Friday, August 24, 2012

SOA 11g- Delete message from JMS Queue using WLST

This Post describes WebLogic Scripting Tool (WLST) commands to delete messages from a JMS message queue. Sometime, you may need to delete all the messages from JMS queues. However, using the Queues > Monitoring tab in the console, you might encounter an out of memory condition. This can happen because the console tries to load the messages prior to deleting them, leading to the out of memory condition.

Run the following sequence of WLST commands, substitute your own server's information where necessary:

Steps to delete messages from JMS queue using WLST

Go To

  $MIDDLEWARE_HOME /user_projects/domains/yourdomain/bin


 $MIDDLEWARE_HOME /user_projects/domains/yourdomain/bin>setDomainEnv.cmd


$MIDDLEWARE_HOME /user_projects/domains/yourdomain> java weblogic.WLST

wls:/offline> connect('weblogic','welcome1','t3://localhost:8001')

Since your JMS Queue targeted to SOA server, so you need to use soa server port in above command. If you will connect by Admin port (7001) then you would not able to delete messages from jms queue which is targeted on soa server. 

wls:/WLST_domain/serverConfig> serverRuntime()


 wls:/WLST_domain/serverRuntime> cd('JMSRuntime/soa_server1.jms/JMSServers/JMSServer-0/Destinations/SystemModule-0!Queue-0')

soa_server1.jms : is your server to which JMS queue resides. In my case it is soa_server1.
JMSServer-0: is your JMSServer that you are using to create JMS queue. In my case it is SOAJMSServer.
SystemModule-0 : is your JMS Module. In my case it SOAJMSModule.
Queue-0: is the jms queue from that you want to delete messages. In my case it is RequestQueue.

wls:/WLST_domain/serverRuntime>  cd('JMSRuntime/soa_server1.jms/JMSServers/SOAJMSServer/Destinations/SOAJMSModule!RequestQueue')


wls:/WLST_domain/serverRuntime/JMSRuntime/soa_server1.jms/ SOAJMSServer/Destinations/SOAJMSModule!RequestQueue> ls()


wls:/WLST_domain/serverRuntime/JMSRuntime/soa_server1.jms/JMSServers/ SOAJMSServer/Destinations/SOAJMSModule!RequestQueue> cmo.deleteMessages('')

Thursday, August 23, 2012

SOA 11g - Undeploy SOA Composite when soa-infra is down

Sometime soa-infra application won’t come up due to corrupt composite which stops the soa-infra to be in active state.  To bring soa-infra up we need to undeploy corrupt composite. But the question arises how we can undeploy corrupt composite while soa-infra is down. There is solution to this. You can undeploy composite by following below steps even if soa-infra is down.

Check the soa logs and determine which composite is causing the problem and then follow the below process to Undeploy SOA composite by editing deployed-composites.xml

1. Download and copy the ShareSoaInfraPartition.ear file to $MIDDLEWARE_HOME/oracle_common/common/bin

2. cd to $MIDDLEWARE_HOME/oracle_common/common/bin and run below command
        
          run  wlst.sh

3. connect to server by using below command and provide username and password.

          connect()

4. run the below command to deploy ShareSoaInfraPartition.ear

         deploy('ShareSoaInfraPartition','ShareSoaInfraPartition.ear',upload='true')

5. Now run the below command by changing the "toLocation" ('/fmw11g/fmw1115/Middleware' is some location path on SOA machine)

exportMetadata(application='ShareSoaInfraPartition',server='AdminServer',toLoc  ation='/fmw11g/fmw1115/Middleware',docs='/deployed-composites/deployed-composites.xml')

6. A deployed-composites folder will be created at "toLocation" path with deployed-composites.xml in it

7. Delete the composite which is causing the problem from deployed-composites.xml and save the file

        for example TestComposite composite like below

<composite-series name="default/TestComposite" default="default/TestComposite!2.0">
<composite-revision dn="default/TestComposite!2.0" state="on" mode="active" location="dc/soa_58b98be8-9ec8-41af-bb83-590f6004d1aa">
<composite dn="default/TestComposite!2.0*soa_58b98be8-9ec8-41af-bb83-590f6004d1aa" deployedTime="2011-11-17T09:01:54.750+05:30"/>

8. Now run the below command by changing the "fromLocation" (this should be the same location as previous)

importMetadata(application='ShareSoaInfraPartition',server='AdminServer',fromLocation='/fmw11g/fmw1115/Middleware',docs='/deployed-composites/deployed-composites.xml')

9. Now bounce your server and the composite will not be deployed by SOA when it comes up and hence that should bring your soa-infra up.


This valid for Oracle SOA Platform - Version 11.1.1.1.0 to 11.1.1.5.0



Wednesday, August 22, 2012

OSB 11g - Call synchronous SOA service using soa-direct protocol

In My previous post, I explained how to invoke synchronous SOA service or any other service from Oracle Service Bus over HTTP. But when we talk about specific to SOA then we have one another protocol (SOA-Direct) which we should use to invoke synchronous SOA service from Oracle Service Bus. Below are the advantages of SOA-Direct protocol.

·         Invocation of any SOA binding component services through Java remote method invocation (RMI)
·         WS-Addressing, including optional auto-generation of ReplyTo properties for asynchronous callbacks
·         Identity propagation
·         Transaction propagation
·         Attachments
·         Optimized RMI transport for invoking SOA services
·         High availability and clustering support
·         Failover and load balancing (not available for services in the Service Callback role
·         Connection and application retries on errors

In this post, we will see how to invoke synchronous SOA service from Oracle service Bus using SOA-Direct protocol. To use the SOA-Direct protocol in OSB, First we need to make changes to our SOA service. We need to change default binding to direct binding. To do that simply drags the “Direct Binding” component from component palette.  In create Direct Binding pop-up window, choose type as service and choose service wsdl file and click on ok.


OSB to SOA Using SOA Direct Modify Composite


Now wire the direct binding service reference to already existing wire so now we can invoke the service either by default binding or by direct binding. Your composite should look like below.

OSB to SOA Using SOA Direct Modified Composite


Now we will create OSB project from where we invoke above created SOA service using SOA Direct protocol. To invoke the service we need either WSDL URL of that service or WSDL file which we need to import to OSB project.

We can not access direct binding from EM console , so to access that service, open the below URL and select your service.


Copy the service endpoint which we will use in later stage.

OSB to SOA Using SOA Direct Service URL


Create a new OSB project and add required folder structure to it. Now click on resource folder and import SOA service resources to OSB by specifying the service URL which we copied in earlier step.

OSB to SOA Using SOA Direct Create OSB Project


Create a business service which invokes the synchronous SOA service. Specify the business service name, choose WSDL as service Type and browse synchronous SOA service WSDL file.

OSB to SOA Using SOA Direct Create Business service


Click on the WSDL file and choose SOA service port with version 1.2. Click on submit.

OSB to SOA Using SOA Direct Choose Port


As mentioned in the starting we use SOA-Direct protocol to invoke synchronous SOA service, so choose “soa-direct” protocol from protocol drop down list. You see that EndPoint URI already added, this is taken from synchronous SOA service WSDL file. Click on next to go over next step.

OSB to SOA Using SOA Direct Choose Protocol


Choose Synchronous client role as we call synchronous SOA service using SOA-Direct protocol.

OSB to SOA Using SOA Direct Sync Client

Accept defaults and save the business service.

Now create the proxy service which route the message to above created business service. Click on proxy folder and choose “Proxy Service” from create resource drop down. Specify the proxy service name and Choose “Business service” as service type and browse above created business service. You can also choose “WSDL” as service type if your requester structure is different.

OSB to SOA Using SOA Direct Create Proxy Service

Accept default for proxy service and save it.

OSB to SOA Using SOA Direct Complete Proxy Service


Open the message flow of the proxy service where you can see route node is added to it and inside route node message is routed to business service.

OSB to SOA Using SOA Direct  Message Flow

OSB to SOA Using SOA Direct  Message Flow Route Node


Activate the session and test the proxy service.


OSB to SOA Using SOA Direct Testing