Pages

Tuesday, March 17, 2009

Calling (A)Sync BPEL services from OSB with ormi / opmn

With OSB 10.3 ( BEA Aqualogic Service Bus ) you can call BPEL services with the ormi or opmn protocol ( just like OESB ). With version 10.3, OSB support the bpel 10.1.3.4 transport. In this blog I will show you how to call the BPEL services from OSB. Calling OSB services from BPEL is also possible but I'll explain this in an other blog entry. I got this working with the MLR5 patch for Soa suite 10.1.3.4.
First we have to do some hacking else we can get this error com.evermind.server.rmi.RMIConnectionException: Disconnected: javax.xml.namespace.QName; local class incompatible: stream classdesc serialVersionUID
First we have to add a java parameter to the OSB server. Go to domains\osb_domain\bin folder and edit the setDomainEnv file and add this line to this file. set JAVA_PROPERTIES=-Dplatform.home=%WL_HOME% -Dwls.home=%WLS_HOME% -Dweblogic.home=%WLS_HOME% -Dcom.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0
Step 2 is to replace the bpel jars in the bpel transport ear. Go folder osb_10.3\lib\transports and open bpel10gtransport.ear and replace the following jar files orabpel.jar, orabpel-common.jar , xmlparserv2.jar and oc4jclient.jar with the ones you can find in the soa suite 10.1.3 home.
Now we are ready to call a Synchronous BPEL service from OSB. Here is a overview picture how it works for a Synchronous Service
First we create a proxy service in the OSB where we use the WDSL of the BPEL service.

Create message flow where we call the Business service which uses the BPEL transport.

Create the OSB Business service where we use the input operation of the BPEL wsdl. OSB detects that this is a BPEL wsdl

Select the bpel-10g transport. As endpoint we can choose between opmn or ormi. For ormi we can use this url ormi://localhost:12401/default/BPELProcess_Sync Where 12401 is the rmi port of the OC4J container and BPELProcess_Sync is the name of the BPEL service. Don't use orabpel in the url. You can also use opmn://localhost:6003/home/default/BPELProcess_Sync where 6003 is the opmn port and home is the name of the OC4J container.
Because this is the wsdl of a Synchronous BPEL proces we have to choose Synchronous client and select a service account ( this contains the oc4jadmin username / password )

That's all for a Synchronous BPEL service.

For an Asynchronous BPEL we have to do a little more. See this overview picture.
Import the wsdl of the Asynchronous BPEL process and use this in a new Proxy Service.

Do the same for a new Business service, this business service is called from the message flow of the just created proxy service.

Select as protocol bpel-10g and use as endpoint opmn://localhost:6003/home/default/BPELProcess_Async.

Now we have to select Asynchronous Client and as callback proxy we have to select a return proxy service and select a service account ( this contains the oc4jadmin username / password )

Now we create a call back proxy service where we select the callback operation of the BPEL service.

Now we have to select SB as protocol

this proxy service calls a business service with the same BPEL wsdl callback operation.

I store the result of the BPEL service in JMS queue

that's all for the Asynchronous BPEL service. For more information see the OSB bpel transport page.

27 comments:

  1. how do you create service account please specify.

    ReplyDelete
  2. Hi ,

    create in workshop or in the sbconsole a new service account then select static as resource type and off course as static username oc4jadmin and your password.

    use this account in the business service

    thanks

    ReplyDelete
  3. i tried following your steps to call synchronous bpel from osb but getting following error
    The invocation resulted in an error: The Oracle BPEL delivery service could not be accessed: java.lang.Exception: Failed to create "ejb/collaxa/system/DomainManagerBean" bean; exception reported is: "javax.naming.NameNotFoundException: ejb/collaxa/system/DomainManagerBean not found
    at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:52)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at com.oracle.bpel.client.util.BeanRegistry.lookupDomainManagerBean(BeanRegistry.java:239)
    at com.oracle.bpel.client.Locator.getDomainAuth(Locator.java:975)
    at com.oracle.bpel.client.Locator.init(Locator.java:73)
    at com.bea.wli.sb.transports.bpel10g.BPELTransportEndpoint.getDeliveryService(BPELTransportEndpoint.java:757)
    at com.bea.wli.sb.transports.bpel10g.BPELTransportEndpoint.sendMessageAsync(BPELTransportEndpoint.java:316)
    at com.bea.wli.sb.transports.bpel10g.BPELTransportEndpoint.sendMessageAsync(BPELTransportEndpoint.java:282)
    at com.bea.wli.sb.transports.bpel10g.BPELTransportProvider.sendMessageAsync(BPELTransportProvider.java:519)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    please suggest.

    ReplyDelete
  4. Hi,

    Does your soa suite server have two oc4j containers and what is your bpel-10g endpoint url.

    your endpoint must connect to the right container

    thanks Edwin

    ReplyDelete
  5. Yes it does have two instances. I changed it to point to local server just for testing.

    My Business Service end point is :

    opmn://localhost:6003/home/default/HelloWorld
    ormi://localhost:12401/default/HelloWorld

    But still i get following error

    The invocation resulted in an error: Unable to failover; nested exception is:
    javax.naming.CommunicationException: Server protocol was not ORMI, if uncertain about the port your server uses for ORMI then use the default, 23791 [Root exception is java.io.IOException: Server protocol was not ORMI, if uncertain about the port your server uses for ORMI then use the default, 23791].

    I thought may be my endpoint uri opmn was second preference so i moved it to first then tried still get following error


    javax.naming.CommunicationException: no message oracle.oc4j.security.KeyExchange.toPublicKey(KeyExchange.java:182)
    oracle.oc4j.security.KeyExchange.setRemotePublicKey(KeyExchange.java:118)
    oracle.oc4j.security.ExchangingEncryptor.setRemotePublicKey(ExchangingEncryptor.java:125)
    com.evermind.server.rmi.RMIProtocol$SecureCredentials.initializeEncryptor(RMIProtocol.java:255)
    com.evermind.server.rmi.RMIProtocol$SecureCredentials.send(RMIProtocol.java:244)
    com.evermind.server.rmi.RMIProtocol.sendCredentials(RMIProtocol.java:95)
    oracle.oc4j.rmi.ClientRmiTransport.connectToServer(ClientRmiTransport.java:91)
    oracle.oc4j.rmi.ClientSocketRmiTransport.connectToServer(ClientSocketRmiTransport.java:68)
    com.evermind.server.rmi.RMIClientConnection.connect(RMIClientConnection.java:646)
    com.evermind.server.rmi.RMIClientConnection.sendLookupRequest(RMIClientConnection.java:190)
    com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:174)
    com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:287)
    com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
    com.evermind.server.rmi.NamedObjectRemoteInvocationHandler.getFreshObject(NamedObjectRemoteInvocationHandler.java:21)
    com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.getFreshObject(StatelessSessionRemoteInvocationHandler.java:21)
    com.evermind.server.rmi.RecoverableRemoteInvocationHandler.getReplacementObject(RecoverableRemoteInvocationHandler.java:64)
    com.evermind.server.rmi.RecoverableRemoteInvocationHandler.handleRecovery(RecoverableRemoteInvocationHandler.java:41)
    com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:30)
    com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
    com.evermind.server.rmi.RecoverableRemoteInvocationHandler.handleRecovery(RecoverableRemoteInvocationHandler.java:49)

    Please suggest.

    ReplyDelete
  6. Hi,

    what is your bpel version number / patch level

    is your soa suite instance running on the same server as the osb else you have to change localhost

    and I don't think bpel is running in the home container.

    change home with your soa suite container name.
    opmn://localhost:6003/home/default/HelloWorld

    or lookup the rmi port of the soa suite container
    ormi://localhost:12401/default/HelloWorld

    ReplyDelete
  7. How do i find BPEL version and patch level?

    Is it BPEL console tells 10.1.3.3.1

    I found following ports from EM
    RMI 12401 12401-12500 (Port Range)

    yes server is running locally but not on weblogic server it is soa suite 10.1.3.3.1

    I can send you files if you can share your email. I tried all option to set serialVersionUID as you said, still getting same issue.



    Mar 24, 2009 1:37:38 PM oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_TH
    E_REMOTE_SERVER
    WARNING: Exception returned by remote server: {0}
    com.evermind.server.rmi.RMIConnectionException: Disconnected: javax.xml.namespac
    e.QName; local class incompatible: stream classdesc serialVersionUID = 441862298
    1026545151, local class serialVersionUID = -916876369326528164
    at com.evermind.server.rmi.RmiCallQueue.notifyQueuedThreads(RmiCallQueue
    .java:70)
    at com.evermind.server.rmi.RMIClientConnection.notifyQueuedThreads(RMICl
    ientConnection.java:154)
    at com.evermind.server.rmi.RMIClientConnection.resetState(RMIClientConne
    ction.java:128)
    at com.evermind.server.rmi.RMIConnection.receiveDisconnect(RMIConnection
    .java:233)
    at com.evermind.server.rmi.RMIClientConnection.receiveDisconnect(RMIClie
    ntConnection.java:140)
    at com.evermind.server.rmi.RMIConnection.handleOrmiCommand(RMIConnection
    .java:208)
    at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RM
    IClientConnection.java:222)
    at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.jav
    a:152)
    at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnec
    tion.java:127)
    at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec
    utor.java:819)
    at java.lang.Thread.run(Thread.java:619)


    Please suggest.

    ReplyDelete
  8. Ok ,

    your version sounds well, but I think you need to have 10.1.3.4

    did you patch the bpeltransport ear of the osb with the jar of your soa home

    I found following ports from EM
    RMI 12401 12401-12500 (Port Range)
    you have two containers so there are two rmi ports active.


    yes server is running locally but not on weblogic server it is soa suite 10.1.3.3.1

    ok that is fine.

    I can send you files if you can share your email. I tried all option to set serialVersionUID as you said, still getting same issue.


    ok can you send your testcase to biemond at gmail dot com.

    and can you send me a pic of your AS overview and the opmn.xml located in opmn/conf/opmn.xml

    thanks Edwin

    ReplyDelete
  9. Quick Question:

    When doing Async BPEL call, in WSDL it imports ws-addressing.xsd and one more xsd. I tried to refer at server location by giving http:// url but it didn't work. So do we really need to download and put physical xsd under the project or i was making some mistake to refer xsd. the way i was referring (tried two ways)
    http://localhost:8889/orabpel/xmllib/ws-addressing.xsd
    http://localhost:8889/xmllib/ws-addressing.xsd

    both didn't work. Any idea how we can do it without importing schema into project?

    ReplyDelete
  10. Hi,

    it should work, you use the bpel console and select the wsdl of the bpel instance, this link address is the right address.

    I don't know if OSB can retrieve the xsd. and maybe the xsd should be relative to the wsdl url.

    thanks

    ReplyDelete
  11. I'm able to invoking the async process but I'm getting this error from BPEL console

    exception on JaxRpc invoke: exception during SOAP invoke: No fault in soap fault payloadA Transport Exception occurred during an SB Transport message processing.; nested exception is:
    com.bea.wli.sb.transports.client.SBTransportException: A Transport Exception occurred during an SB Transport message processing.; nested exception is:
    com.bea.wli.sb.transports.client.SBTransportException: A Transport Exception occurred during an SB Transport message processing.

    Would you please mention the steps required to create and store a message in jms queue at OSB level.

    ReplyDelete
  12. Hi,

    just create in the console of the OSB server ( /console ) a connection factory and a queue and target these object to the OSB server.

    create callback proxy server which uses the sb transport and only call the jms business server and use jms text message option.

    Now you can take a look in the console at your queue and go to monitor to see the message.

    thanks

    ReplyDelete
  13. Hi.

    To make this work you will need to use jdk 1.5 version 16 and soa suite 10.1.3.4 with mlr3 patch or higher

    and need to apply patch 5507491
    NAMESPACE PREFIX IS NOT DECLARED USING XML PROGRAM

    thanks Edwin

    ReplyDelete
  14. I share the same views. Liked your blog very much.

    ReplyDelete
  15. Hi Edwin,

    How is the example of endpoint URI if we call BPEL (installed on top of Weblogic92) from OSB using t3 transport.

    Currently I use http transport but I'm not satisfy with the performance.

    Thanks before.

    Pazzini

    ReplyDelete
  16. Hi,

    You have to use bpel 10.1.3.4 with the latest mlr patch and you can't use t3 , just use ormi

    this will be the url in osb
    opmn://localhost:6003/home/default/HelloWorld

    or

    ormi://localhost:12401/default/HelloWorld

    in soa suite 11g you can use t3

    thanks Edwin

    ReplyDelete
  17. I followed your link and copied the jar files from SOA Suite 10.1.3.4 MLR#10 to OSB ,added the set java properties but after that when i restarted my osb server,i am getting following issues

    <Exception on
    ransportManagerImpl.loadCommitted, com.bea.wli.sb.transports.TransportException
    No transport provider registered with ID: bpel-10g
    com.bea.wli.sb.transports.TransportException: No transport provider registered
    ith ID: bpel-10g

    and i can no longer see the bpel-10 transport protocol in osb console


    Please suggest on the same.

    ReplyDelete
  18. Hi,

    Ok that is strange and when you put the original back then you got it bpel-10g transport back.

    please compare the new with the old one.

    thanks

    ReplyDelete
  19. When i copy the original one it still is giving same issues to me.

    I am able to work with other transport protocol but bpel-10g transport is not working for me.

    I have set in setDomainEnv.bat

    set JAVA_PROPERTIES=-Dplatform.home=%WL_HOME% -Dwls.home=%WLS_HOME% -Dweblogic.home=%WLS_HOME% -Dcom.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0

    I believe WLS_HOME is nothing but ALSB_HOME

    Again i copied all the jar files and restarted the server.

    Am i missing something?I am struggling hard to get this fixed.

    I checked in other forum links they suggest the same steps what you have suggested.

    Is it specific to some particular MLR as i am on MLR10

    ReplyDelete
  20. I just missed i am using OSB 10.3.1

    ReplyDelete
  21. Hi,

    did you get the bpel-10g transport option with the original and patched ear.

    and check the server logging there must be an error.

    thanks

    ReplyDelete
  22. Hello i am getting following error

    java.net.SocketException: Software caused connection abort: socket write error
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:136)

    while calling business process .

    Please suggest

    ReplyDelete
  23. Ok,

    socket errors, or you got an Operating System problem or you got the port number wrong of the oc4j container. please check the port number in the EM of the oc4j container.

    thanks

    ReplyDelete
  24. its a wonder post mate... i really like this...

    ReplyDelete
  25. Hi Edwin,
    I have a simple requirement of calling SOA composite from OSB synchronously. I know this can be done by exposing direct binding in composite and consuming relevant WSDL in OSB Proxy. My question is -
    (1) why should we use direct binding. what if we use composite WSDL directly in OSB like any other web service? can you please provide pro & cons.
    (2) When I see composite instance in EM using direct binding approach I can see BPEL instance in EM. however when I open BPEL instance it shows all other instances as well those got created earlier by direct binding. I have to figure out relevant instance and then open it for flow trace. Not sure why it doesn't show only relevant instance. it looks little clumsy. that's why I asked 1st question above. what are your thoughts on this. can this be avoided ?

    ReplyDelete
    Replies
    1. Hi,

      it is about performance and transactions. with direct binding you all got this, with ws you got all the xml to java transformation and no transaction support. SOA suite does this internally when it detects it run on the same jvm even when you use http binding.

      it looks like a bug.

      thanks

      Delete
  26. Thanks Edwin this helps.

    ReplyDelete