Friday, April 25, 2014

SOA 11g - weblogic.connector.exception.RAException: Jndi name is null or empty

Sometime we face below issue when we try to activate the DB adapter from prepare state.

Error:

An error occurred during activation of changes, please see the log for details.
weblogic.connector.exception.RAException: Jndi Name is null or empty.



And when DB adapter is in prepared state and you try to run the composite using db adapter you will get below exception.

<bpelFault><faultType>0</faultType><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'DB_Insert' failed due to: JCA Binding Component connection issue. JCA Binding Component is unable to create an outbound JCA (CCI) connection. SampleInsert:DB_Insert [ DB_Insert_ptt::DB_Insert(DB_InsertInput_msg) ] : The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: BINDING.JCA-12510 JCA Resource Adapter location error. Unable to locate the JCA Resource Adapter via .jca binding file element &lt;connection-factory/> The JCA Binding Component is unable to startup the Resource Adapter specified in the &lt;connection-factory/> element: location='eis/Db/localds'. The reason for this is most likely that either 1) the Resource Adapters RAR file has not been deployed successfully to the WebLogic Application server or 2) the '&lt;jndi-name>' element in weblogic-ra.xml has not been set to eis/Db/Betsyg6apps. In the last case you will have to add a new WebLogic JCA connection factory (deploy a RAR). Please correct this and then restart the Application Server Please make sure that the JCA connection factory and any dependent connection factories have been configured with a sufficient limit for max connections. Please also make sure that the physical connection to the backend EIS is available and the backend itself is accepting connections. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary></part><part name="detail"><detail>JCA Resource Adapter location error. Unable to locate the JCA Resource Adapter via .jca binding file element &lt;connection-factory/> The JCA Binding Component is unable to startup the Resource Adapter specified in the &lt;connection-factory/> element: location='eis/Db/localds'. The reason for this is most likely that either 1) the Resource Adapters RAR file has not been deployed successfully to the WebLogic Application server or 2) the '&lt;jndi-name>' element in weblogic-ra.xml has not been set to eis/Db/Betsyg6apps. In the last case you will have to add a new WebLogic JCA connection factory (deploy a RAR). Please correct this and then restart the Application Server </detail></part><part name="code"><code>12510</code></part></bindingFault></bpelFault>

Resolution:

To resolve this error mean to activate the db adapter from prepared state, you need to look into your Plan.xml file.

You can find Plan.xml at below location

C:\Oracle\Middleware\Oracle_SOA1\soa\connectors

In my case I see there two entries in Plan.xml file as shown below which was causing the issue. I removed that entries and redeploy the adapter and it comes in active state.

<variable>
      <name>WeblogicConnector_JNDIName_13984068960991</name>
      <value></value>
    </variable>



<variable-assignment>
        <name>WeblogicConnector_JNDIName_13984068960991</name>
        <xpath>/weblogic-connector/jndi-name</xpath>
      </variable-assignment>


Wednesday, April 16, 2014

OSB 11g - Service Callout In Oracle Service Bus

We use Service Callout option inside Oracle Service Bus to call any service inside message flow to get the required data. In this post, I will show you how to use Service Callout activity in Oracle Service Bus and pass the response from callout service to next service.

To show how Service Callout works in Oracle Service Bus, we have created two services. First service (Customer Name Service) will return Customer Name as response message when we pass Customer Id as request message and second service (Target Service) accept both Customer Id and Customer name as request message.

We use Service Callout option to call first service (Customer Name) and pass Customer Id as input to it and it will give us Customer Name as response message. We will use service callout response message and add it to the proxy service input and pass it to target service which accepts both Customer Id and Customer Name.



First Create a New OSB Project and add proxy, business and resources folders to it.



Load first & second service WSDL and XSD files to newly created project under resources folder.

Now we create Business service using first service WSDL file. We later use this business service in Service Callout activity.




Accept defaults and save your business service.


Now Create Business service using second service WSDL. This will be our target service means we will route the final message to this service.




Now create a proxy service using first service WSDL file.



Now we will add required activities or logic in the Proxy service message to do Service Callout and pass service callout response to another service.

Go to Message Flow of proxy service and click on “Add Route” to add route Node. Rename the route activity.

Click on “Edit Route”  and then click on “Routing” to add routing inside message flow.




Choose “Target Business Service” created above as this is our target service and we need to pass final complete message to this service.

Choose service operation.


In the Request Action, add “Service Callout” activity to call first service (Customer Name service).



Choose service operation and define request and response messages.



Now we need to assign request message to Service Callout request message. To do that first we need to create two variables inside message flow with the name “CustomerNameReqMsg” & “CustomerNameRespMsg”.

Refer to my previous post to see how to create custom variables in Oracle Service Bus.

For  CustomerNameReqMsg assignment , add Replace activity.




In the replace acitivity pass the Customer Id from proxy Request message to CustomerNameReqMsg variable.



Click on “Replace Node Content” as we need to pass the content to CustomerNameReqMsg variable.



If you will save your message flow and test the proxy service till here, you will see that you are able to call Customer name service using Service Callout.

Now in the next step we will use Service callout response message, add it to Proxy request message and pass the message to target service.

To do this add “Replace” activity. Take data from CustomerNameRespMsg variable and add it to body variable which is proxy service message.



Save your flow and activate the session.


Testing Results



Download Sample Code 

Tuesday, April 15, 2014

OSB 11g - Create Variable In Oracle Service Bus

As we know Oracle Service Bus is stateless so we always deal with body variable inside proxy service message flow but in some case we do required custom variable.

In this post, I will show you how to create variables in Oracle Service Bus. We create custom variables in Message flow when you do variable assignment using assign or replace activity.

Click on “Variable Structures” link.



To add new variable click on “Add New Structure” link.

In OSB we can have three types of variable as shown in screen shot below.

In this post, we will create XML type variable so choose this link.



Fill values for variable label and path.

Structure Label:  It is name of the variable.
Structure Path: Variable path means how we will access this variable in Message flow.



To create XML Type variable we can choose either “Schema Element” or “WSDL Element”.

Schema Element: When you are using external schema.
WSDL Element: When you are using Inline schema means you have define your schema inside WSDL only.

Since we have external schema so we will choose “Schema Element”.


Click on Browse and choose the schema element.



Below is the variable created, now we can use this variable inside Message flow.


Wednesday, April 9, 2014

OSB 11g - Error Handling In Oracle Service Bus

In this post, I will show you how to do error handling in Oracle Service Bus. To show this we have prepared a use case, in this use case we call SOA web service from Oracle Service Bus. But we shut down the SOA service to generate the error so when Oracle Service Bus try to call SOA service it will get error out and we will handle that fault in Oracle Service Bus. In the Oracle Service Bus error handling once we receive the fault message, we will send that fault message to JMS queue.



To send message to JMS queue, we will use re-use the business service that we created in previous post.

First Create an OSB project. Create three folders under project.




Load SOA service WSDL & XSD file to resource folder of newly created OSB project.






Create a Business service which will call SOA service. To create it click on business folder and choose “Business Service” from resource type drop- down.

Name your Business Service and browse WSDL file of SOA web service.





Choose WSDL binding and click on submit.





Set the EndpointURI for SOA service.




Accept defaults and save your business service.

Now we will create proxy service which invokes newly created business service. To create proxy services click on proxy folder and choose “Proxy Service” from resource type drop-down.

Name your proxy service and browse newly created business service.





Accept default and save your proxy service.

Now we will add error handling to Proxy service to handle fault generated when we call SOA service.

To add error handling, go to message flow of proxy service. Click on route node and click on “Add Route Error Handler”.




Once you add route error handler, right-click to add the stage. Name the stage activity. Click on Edit Stage to add required activities inside error handler.





Inside stage activity click on “Add an Action” and add “Publish” activity which will call JMS queue business service which send the message to JMS queue.




Now we need to pass fault message to business service that we have configured inside publish activity. For that add “Replace” activity. Now whatever you want to pass to JMS queue you can choose from fault variable.





We will assign fault message to body variable of business service.





Add reply activity after the publish activity.

Click on validate and save the flow. Activate the session.

Testing Result

We have shut down the SOA service so that we get fault when OSB try to call it.



Now test the proxy service. When you test the proxy service you will see error message.




Now to check whether OSB error handler is working or not, go to JMS queue and check the message.