Thursday, August 18, 2011

ADF Integration With SOA 1 - Business Events.

While working with Business Events (BEs), I faced some issues. In this blog, I am documenting whatever I did to successfully raise BEs.
I have divided this blog into 3 sections:

  1. Setup Required for BEs.
  2. Code Development.
  3. Deployment and Running the application to raise BEs.
For this example, I have used two servers:
  1. JDev's Integrated WLS (IWLS) for ADF application that raises the BE.
  2. Standalone SOA Server - Separate server where SOA application ( that will consume the BE raised by ADF app ) will be deployed.
Both the server are using my local Oracle Database for EDN. So, same EDN is shared by both the servers.
Hence, you can deploy each application on separate servers.

Setup Required for BEs.

Download and install SOA extension on JDev so that IWLS will have the libraries required for BE. Specifically, 'oracle.soa.workflow.wc'. To download SOA extension, go to Help->Check For Updates:


Do not uncheck 'Oracle Fusion Middleware Products' & 'Official Oracle Extensions and Updates', and click Next.


Select SOA extension and click Finish. Since I have already done it, so my JDev is not showing that entry now so can't add that snapshot.

The SOA extension will take some time to download. Once that is done, start the server, and in the IWLS console, you will be able to see an entry for 'oracle.soa.workflow.wc' library in the Deployments page.


Without this library, while raising BEs, you will get the following error:

<Utils> <buildFacesMessage> ADF: Adding the following JSF error message: oracle/fabric/blocks/event/BusinessEventConnectionFactory
java.lang.NoClassDefFoundError: oracle/fabric/blocks/event/BusinessEventConnectionFactory
at oracle.jbo.server.EventInvocation.raiseEvent(EventInvocation.java:513)
at oracle.jbo.server.EntityImpl.raiseEvents(EntityImpl.java:7724)
at oracle.jbo.server.EntityImpl.afterCommit(EntityImpl.java:7329)
at oracle.jbo.server.DBTransactionImpl.doAfterCommit(DBTransactionImpl.java:2285)
at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:2176)
at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2369)
at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1608)
. . .
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
Caused by: java.lang.ClassNotFoundException: oracle.fabric.blocks.event.BusinessEventConnectionFactory
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
... 65 more

By installing SOA extenstion to JDev, we can use JDev's IWLS to raise events successfully.
Apart from this, you need to create the following two Data Sources(DSs) on IWLS:
  • EDNDataSource (XA DS )
  • EDNLocalTxDataSource (Non-XA DS)


If you don't define these DSs, you will get the following messages in JDev log while raising BEs:

INFO: Looking for BusinessEventConnectionFactory
INFO: Looking for EDN-DB JNDI configuration to create SAQRemoteBusinessEventConnectionFactory.
INFO: Unable to create SAQRemoteBusinessEventConnectionFactory: [jdbc/EDNSource or jdbc/EDNDataSource] undefined.
INFO: Looking for EDN-JMS JNDI configuration to gcreate JMSRemoteBusinessEventConnectionFactory.
INFO: Unable to create JMSRemoteBusinessEventConnectionFactory: [java:comp/UserTransaction] undefined.
INFO: Unable to create JMSRemoteBusinessEventConnectionFactory: [jms/fabric/EDNConnectionFactory] undefined.
INFO: Failed to get ConnectionFactory instance.
. . .
<JmsBusinessEventBusMessages> <warnUsingGlobalDatasourecForLocal> Local Tx Datasource not found, using XA datasource. Please update your configuration.

Once you define these DSs successfully, you wont get these messages in JDev log, and are required for successfully raising BEs.

EDNSource is not required if you define EDNDataSource. Looks like ENDSource is an old name of the driver and the new name is EDNDataSource.

In my case, SOA Server is already having these DSs, so I just replicated those DSs on IWLS.
For more details about DSs, please refer to the following forum post:

Code Development.

I have created a small application over SCOTT.EMP table to raise a BE on employee creation.


EmpEO is based on SCOTT.EMP, and added to AppModule through EmpVO. Using the Business Events section of EmpEO, I defined and published the following event:


The following is the event definition:


And here is now the event is published:


After that, I created a simple page for EmpVO, and added two buttons, one for row insertion, and second one for commit:


Then, in the weblogic-application.xml, visible in Descriptors->META-INF folder in Application Resources, I added the following entry:


This is done so that we can get access to 'oracle.fabric.blocks.event.BusinessEventConnectionFactory'.
If we straight away add 'SOA Runtime' or 'SOA Workflow' library to our model project, some how the class is not accessible, so getting this from the server itself.

Then created a small SOA application to subscribe to the event using Mediator, and writing the payload to a text file using a File Adapter:


The Mediator in the above figure points to the EmpEO.edl and EmpEO.xsd files of the previously created ADF application. The mediator passes the payload to BPEL:


And here is the transformation:


The following image shows the structure of BPEL, which transfers to payload to File Adapter:

And File Adapter writes the paylaod to a file in C:\TEMP folder:

Using the EmpEOs schema:

So, now lets run the application to raise BEs.

Deployment and Running the application to raise BEs.

Deploy the SOA application to the standalone SOA Server:


And run the ADF Application using CreateEmployee.jspx. Click 'CreateInsert' to insert a row in the table as shown below:

After entering the data, Click Commit. The BE is raised, and you can confirm by querying 'AQ$EDN_EVENT_QUEUE_TABLE' view:
If there is a consumer, like SOA app in our case, the records get vanished after a min or so, and SOA app writes the following paylaod to a text file as expected:

Done.

JDev Release 11.1.1.4

70 comments:

  1. Thanks Lalit for the documentation.
    Also,I would like to know how do I publish events for master detail link ,so that payload contains multiple line details for each master.

    ReplyDelete
  2. Please refer to my following post for details of business events in case of compositions:

    Business Events Support In Case Of Composition Scenarios

    ReplyDelete
  3. Great blog you people have maintained there, I totally appreciate the work.
    event management software

    ReplyDelete
  4. I really enjoy while I read your blogs and articles.
    payday advance

    ReplyDelete
  5. Your articles don’t beat around the bushes exact t to the point.
    pork chop recipes

    ReplyDelete
  6. It feels great to feature much revealing and unequalled articles on your websites. Relationships by Shchilian

    ReplyDelete
  7. I would never like to fail out any chance to read out your listings.
    Learn More About Pool too You

    ReplyDelete
  8. Amiable articles and the blogs really helped me a lot, thanks for the valuable information.
    Cape Seek Homepage

    ReplyDelete
  9. I want more and more articles and blogs please post soon such informative information.
    online payday loans

    ReplyDelete
  10. I’m thrilled I found your website and blogs. Nice guys!!!
    online payday loan lenders

    ReplyDelete
  11. Your articles are more than wow! And also the best way to make understand the things mentioned in it. Cagla Yanas Tips

    ReplyDelete
  12. You have done really a superb job with your web site. Marvelous stuff is here to read.
    Asum Tips And Tricks

    ReplyDelete
  13. I continuously keep on coming to your site again just in case you have posted new contents.
    ppi

    ReplyDelete
  14. How fine of you!!!! Really awesome efforts you have shown.
    accident claims

    ReplyDelete
  15. I’ve been admirer of your website because I have got the great articles here. bad credit payday loan

    ReplyDelete
  16. It's been good to see your blog when I always look for such type of blogs. It’s great to discover the post here. ppi claims

    ReplyDelete
  17. Great blogs buddy……… this will definitely assist me. Go to Dance Fox 24

    ReplyDelete
  18. Your listing are progressing with days dungeon it up guys.
    Good Relationship With Tico Art

    ReplyDelete
  19. I want to say many more thanks for providing instructive and qualitative stuff here.
    Full Sky Ico Article

    ReplyDelete
  20. I conclude I have selected the smart and inconceivable website along with interesting stuff.
    full coverage auto insurance

    ReplyDelete
  21. The writer understand better the mind of people what they want to learn through their writing therefore this article is outstanding. Thanks!!!
    good infographics

    ReplyDelete
  22. I am confident you've got a great enthusiast following there.
    infographics design

    ReplyDelete
  23. Fine method of telling, and enjoyable article to acquire factual statements. good infographics

    ReplyDelete
  24. This blog has very distinct features. Thanks
    payday loans washington

    ReplyDelete
  25. Hmm!! This blog is really cool, I’m so lucky that I have reached here and got this awesome information.
    whole life insurance prices

    ReplyDelete
  26. The information in this blog is extremely useful for the people. good infographics

    ReplyDelete
  27. I’m definitely coming again to see these articles and blogs.
    a1c chart

    ReplyDelete
  28. That’s a nice site you people are carrying out there.
    whole life insurance quotes

    ReplyDelete
  29. Your way to enlighten everything on this blog is actually pleasant, everyone manage to efficiently be familiar with it, Thanks a great deal.cheap car insurance

    ReplyDelete
  30. I really love your write-ups guys continue the good work. auto insurance

    ReplyDelete
  31. I will prefer this blog because it has much more informative stuff.
    online tutoring companies

    ReplyDelete
  32. I have looked for so several posts about the blog lovers except this post is of course a nice one, keep on.
    language tutor online

    ReplyDelete
  33. Amiable articles and the blogs really helped me a lot, thanks for the valuable information.
    New York medical malpractice lawyer

    ReplyDelete
  34. Hi guys, when I am actually willing of reading these blog post to be updated regularly. It offers fastidious stuff.
    payday loans online

    ReplyDelete
  35. Hey buddies, such a marvelous blog you have made I’m surprised to read such informative stuff.
    zip password unlocker

    ReplyDelete
  36. Pretty remarkable post. I simply came across your blog and desired to say that I have really enjoyed searching your blog posts.
    online payday advance

    ReplyDelete
  37. Mind-boggling job mates, I take pleasure in longing your articles.
    click here

    ReplyDelete
  38. congratulations guys, quality information you have given!!! schaumburg bars

    ReplyDelete
  39. The Info in the blog is out of this world, I so want to read more. personal trainer

    ReplyDelete
  40. The Info in the blog is out of this world, I so want to read more. personal trainer

    ReplyDelete
  41. I have spent a lot of the time in different blogs but this is really a unique blog for me.
    buy twitter followers UK

    ReplyDelete
  42. Fascinating information I haven’t been experienced such information in quite a long time.buy twitter followers UK

    ReplyDelete
  43. Thumbs up guys you are really carrying out a great job.Top Level Domain

    ReplyDelete
  44. This text may be value everyone’s attention. How will I learn more?
    vietnam visa

    ReplyDelete
  45. Your articles support me a lot in all mediums of subjects.
    central booking staten island

    ReplyDelete
  46. Your contents are too straightforward to browse and easy to understand.


    queens central bookingcentral booking ny

    ReplyDelete
  47. I’m so lucky that I have got this site that imparted me the high quality of information easily.


    VLC Media Player

    ReplyDelete
  48. Thanks friends, for providing such enlightening data.

    filezilla client download

    ReplyDelete
  49. Your articles and blogs are inspirational.
    vietnam travel

    ReplyDelete
  50. I constantly emailed this site post page to all my friends, because if prefer to read it then my all friends will too.vietnam holiday

    ReplyDelete
  51. Fine method of telling, and enjoyable article to acquire factual statements.vietnam travel

    ReplyDelete
  52. Hurrah, that’s what I was trying to get for, just what a stuff Presented at this blog!! Thanks admin of the site. vietnam holiday

    ReplyDelete
  53. Nice answers in replace of the question with real point of view and explaining about that.
    sewing kit

    ReplyDelete
  54. Wonderful, just what a blog it is! This blog has provided the helpful data to us continue the good work.
    best credit repair services

    ReplyDelete
  55. It’s a classic great for me to go to this blog site, it offers helpful suggestionsvietnam tour

    ReplyDelete
  56. I'm certainly very happy to read this blog site posts which carries plenty of helpful data, thanks for providing such information.vietnam travel

    ReplyDelete
  57. This blog post is really great; the standard stuff of the post is genuinely amazing. vietnam holiday

    ReplyDelete
  58. I have never been to such type of posts before truly remarkable stuff it has..
    electrical contractors brisbane

    ReplyDelete
  59. Finally I’ve found your blog, awesome way of explaining each and everything really.
    Manhattan central booking

    ReplyDelete
  60. Great webpage brother I am about to notify this to all of my friends and contacts..
    New York Arraignment Lawyer

    ReplyDelete
  61. Your blogs are truly awesome I have no words to praise for your blogs.
    queens central booking

    ReplyDelete
  62. This comment has been removed by the author.

    ReplyDelete
  63. Can you please elaborate on EDNdataSource you created above?
    is it pointing to DEV_SOA_INFRA or HR Schema?

    ReplyDelete
  64. Thank you for your blog! It is really worth sharing and I'm glad that it helped me find RapidRupee app which provides payday loans & it is great.

    ReplyDelete