Tuesday, June 21, 2011

Publish to EDN from java & OSB with JMS

My previous blogpost was about how to configure the SOA Suite EDN for JMS ( EDN-JMS ) instead of AQ (EDN-DB) and in this blogpost I will show you how you can publish events from Java and OSB.

Before we start you should know that we can only make Remote Event Connections because you are running the Java or OSB process in a different JVM then the SOA Suite. And only asynchronous subscriptions will be supported for remote event connections.

First let's create a Java Client which publish the events directly to the SOA Suite Server. I will use the jars of the SOA Suite. This is not necessary. You can just publish a JMS text message and set some JMS Header properties (MessageType and SideCar )

Make a new JDeveloper  project which contains the following libraries.

Here is my test class.
And this will produce the following event on the EDN Queue.

The second part of this blogpost is how to do this in OSB.
Before we can work on the Proxy or Business Service we need to create a Foreign JNDI Provider on the WebLogic Service. ( You can also use a JNDI Provider of the OSB Configuration project )

Provide the SOA Server details.

Provide the local and remote EDN-JMS JNDI Link names. The Remote JNDI Names are fixed but you can change your  local ones.

Restart the OSB Server and open OEPE or the SBConsole.

Create a new Business Service and choose for Messaging Service as Service Type.

Event is an One Way Operation so only need to set the Request Message Type to text.

Use the Local JNDI names of the Foreign JNDI Provider in the Endpoint URI

 Select Text as Message Type.

Create a Proxy Service which call this Business Service, where we will replace the Body contents with the event data and set some JMS Headers in the Transport Header.
 Replace the body contents in a Replace Action.

My test event, the values of Id and ecid element contains unique UUID values.

And the last part is to set the Messagetype and SideCar JMS Headers
MessageType is always Remote
SideCar in my case

<business-event-sidecar xmlns:ns=""
<name xmlns="">ns:EmployeeEvent-sidecar</name>

You can test the Proxy Service in the SBConsole.


  1. Nice Post!
    But while running Java code to publish message to JMS queue of EDN I'm getting below error,
    cannot find constructor JmsRemoteBusinessEventConnectionFactory(javax.jms.QueueConnectionFactory,javax.jms.QueueConnectionFactory,java.util.Queue,javax.transaction.UserTransaction)

    at line ,
    BusinessEventConnectionFactory factory =
    new JmsRemoteBusinessEventConnectionFactory(queueConnectionFactory,
    Please suggest.

  2. Hi,

    I tested it with jdev ps3 and the matching SOA plugin . I think ps4 should also work. Not 11gR2

    Did you use jdev and do you have the same libraries on your project.

    Thanks Edwin

  3. Ya I tested with PS3 only , might be making some mistake will recreate ...
    For the OSB part its working fine with me but JMS endpoint for EDN queue is different ,

  4. Hi Edwin, I am trying to run the OSB on my local server whereas the EDNQueue has been configured on remote server. I am getting the Failed to resolve error. I have provided the endpoint of remote Queue, Do you reckon there is a need of any other setting?

  5. Hi,

    what you can do is to go directly to the soa server instead of the foreign jndi

    use this url in the BS service jms://soa:8001/jms.fabric.xaEDNConnectionFactory/jms.fabric.EDNQueue

    good luck

  6. Shouldn't you close your connections in a finally block?

  7. Hi Edwin
    Thanks for posting nice article but I did not understand how it will work for osb. Are there any disadvantages if we directly produce message to the edn queue from osb? I tried to produce the message but did not see in the queue.

    1. Hi,

      Did you this as jms endpoint url

      no need for foreign server and did you try it in the Java client.

      Good luck

  8. I liked your post. Can you please tell me does it work for only EDN-JMS? Can I use osb to publish to EDN-AQ? why did you use mq in transport header? In the transport header you added another business event what is it? I am sorry for asking lot of questions.

    1. Hi,

      You can try it with a JCA AQ adapter Business service , don't know what you need to fill for AQ header and payload. probably the same.

      I need to set the MessageType and only mq got this. No problem it works also for jms transport

      I think EDN needs this, to route the message so it does not need to analyze the payload.


  9. Hi,

    I'm interesting in the next line of code - conn.publishEvent(builder.createEvent(), 4);
    What meaning second publishEvent() method parameter and why it set to 4?


    1. Hi,

      I don't know exactly but I think it is for defining a remote edn event. in this blogpost it should be remote, soa composites can't be part of the same transaction.


  10. Hi Biemond,

    I have some couple of questions.

    1. Is there way to subscribe the events using Java API
    2. What level of OWSM security we can use in the event.
    3. If there are no event subscribers, what happened to published message?


    1. Hi,

      1) No use a JMS topic, Only SOA Suite can listen for edn events other can publish , Only advantage of EDN is de event xsd can be seen and used everywhere and no need for JMS configuration.

      2) OWSM only works for web services , EDN is more JMS. In weblogic JMS you can protect the topics and queues.

      3) Gone in the wind. Don't think EDN has durable subcribers like jms topics.

      So JMS is not so bad

  11. Hi Edwin,

    I successfully could able to post the message to the queue, but was not able to consume this.. and i followed the steps from your post -

    So any idea on why the message is not consumed.

    Please advise.


    1. Hi,

      did you see this comment
      I have managed to get this working... It worked once I deployed the listener code to the server. I presume that it was throwing away the messages if there were no subscribers to the queue.

      So you need to have a listening and maybe also an edn producing composite to activate EDN


  12. Thanks Edwin. Really appreciate you for all your posts.

    They really help us.

  13. Hi Edwin,

    We are using mediator to listen a Item Business event (Oracle Applications (PIM)) and from there we use AIA architecture to target applications. But as the message flow is very slow and very heavy they wanted to rewrite the fusion layer with OSB. Iam trying to do a POC on that by using a java client to read business event and then using service callout to call some web service and publish to target application.

    1. Is it possible to use Java client to pull message from business events ?
    2. How business events are working ?


    1. Hi,

      do you mean EDN, just switch to JMS and use a Topic with durable subscripbers or a Queue. it works the same.


  14. Hi Edwin,

    we all know that OSB can publish to queue/topic in text or byte message formats. Here I am trying to publish Map Message type to a topic with OSB. I am getting error while invoking the service that it is not either text or byte message. I tried the same with BPEL and it worked fine but trying with OSB always failing. Can you please direct me in right direction.
    whether OSB support MapMessage format in queue/topic while publishing?
    if so how.


    1. Hi,

      Did you use a Java Callout to create a byte Message. By the way are you using the OSB JMS transport . BPEL uses the JMS JCA adapter. Maybe you can use that in OSB.


    2. Which jar files did you include? The sceenshot doesn't list their names to build it with another IDE.

    3. Hi,

      it's made it in Jdeveloper with the matching soa addon.
      I think I used this project



  15. Hi Edwin,

    Thanks for all the great articles.
    I followed this article to post an event to EDN.. It works perfectly!

    But the Java client (Eclipse project) has dependency on following list of jars -




    and XML parser jars.

    I'm writing a piece of code which runs in another FMW server which would post events to EDN.
    The problem is having all these dependencies in an Non-SOA middleware. Is there a way to get rid off these dependency?

    Thanks in advance.

  16. Hey Edwin,

    Can you help me on how to get SOA Composites status by a script may be WLST or by Java? i want to fetch the status of some of the composites, how should i proceed?