Sunday, July 26, 2020

Configuring database adapter in SOA 12c

Hello everyone! In this post, I'm going to show you how to configure database adapter in weblogic server in SOA 12c. Note that I'm using Integrated weblogic server here.


1. Go to weblogic server and click on Data Sources under Services.





Click on New>Generic Data Source.





Give a name for the data source. Leave the Scope as Global. JNDI should be jdbc/<Your data source name>. Then click Next.





Select the Database Driver as below if not already selected. Click Next.





Uncheck the option Supports Global Transactions, and leave all the default options. Click Next.





Now, give your database connection details and click Next.




In the next step, click on Test Configuration.





It should give the message as 'Connection test succeeded' if your connection details are correct. Click Next.





Select the target servers and click Finish. In my case, it is DefaultServer since it is integration weblogic server.





After clicking Finish, you should see the message as below.





Now, you should see your defined data source under data sources. If it is not available in the list, click Next.




Now, go back to Deployments.





Below step is optional but if you check the Exclude libraries option, it'll be easier for you to go to DBAdapater without clicking on Next to search for it every time. To exclude libraries, just expand the Customize this table option and check 'Exclude libraries when displaying deployments'. Click Apply.





Now you click on DBAdapter.





Go to Configuration>Outbound Connection Pools. Click New.





Click Next.




Give a JNDI name and click Finish.





You'll see the messages as below.





Now check the checkbox of DBAdapter. Click Update.





Click Next.





Click Finish.





Below messages will be populated.





Now, go to Deployments, click on DBAdapter>Configuration>Outbound Connection Pools. Expand the list and click on your connection.





Give your jdbc/<your connection name> under property value of XADataSourceName. Press enter and then save. If you don't press enter after entering the value, it won't take the value.





Now go back to Deployments one last time. Check DBAdapter and click Update.





Click Next.





Click Finish.





You'll see the messages as below.





Congratulations, you've configured database adapter on your own. Now, deploy and test your services with db adapter. Cheers!!

Thursday, July 16, 2020

Fault Policy Document in SOA 12c

Hi, Welcome to my blog! In this post, I'm going to show you how we use fault policy document in SOA 12c. Here, I will use FPD for remote fault.

First, we will be creating two projects. First project will take input and give output. We'll create another project and call first project in the second project. Then we'll purposely shut down first composite and define a fault policy in second composite to handle the fault using fault policy document. So lets get started.

1. Create a sample project.





Drag and drop a BPEL with Synchronous interaction.





Assign input variable to output variable using Assign activity. Concatenate 'Hello' to input variable when assigning it to output or leave it as it is to get the exact input as output.





Now, deploy your composite and test it by giving some value in input payload. If you are new to SOA and want above composite in detail, check out my Hello World example.





You'll see output as below:




So, first SOA project is working as expected. Copy the WSDL URL of this composite.


2. Create another SOA Project as below.





Drag and drop a SOAP Adapter to the External Services swim lane. Paste the copied URL into the WSDL URL and click OK.





Drag and drop a BPEL and select the Template as Synchronous.





Wire the BPEL to SOAP reference.





Edit the BPEL and add an Invoke activity in between Receive and Reply. Wire it to SOAP and create Input, Output variables.





Drag and drop two assign activities to assign input to Invoke input and Invoke output to output variable.









Your final composite should look like this:





Now, deploy and test this composite.






You'll get output as below. Here, second composite is invoking the first composite.




Now, shut down the first composite.





Test the CallSampleHello composite. You'll get an invocation error which is a remote fault.





You can see the Recovery status as Nonrecoverable.




We will handle this remote fault using Fault Policy Document.


3. Create a fault policy document in second project. 
Right click on Project>New>From Gallery>Fault Policy Document>Select and Click OK.





Select the Fault Name as Remote Fault and give the Default action as Default Retry.






You can also set the number of retries it has to attempt.




As soon as you create this fault policy document, you'll see fault-policies.xml it in your project artifacts on the left pane.


Now, bind this document to your composite. Go to the Composite of CallSampleHello or whichever is in your case. Click on the highlighted icon to bind the fault policy.





Give your fault policy name under Policy. Click OK.





You'll now see fault-bindings.xml file in your artifacts. 

Save All and deploy your composite. Go to flow instances and Click on your composite. You can see that it has attempted 3 retries.






Note: Sometimes, when you bind the fault policy document to your composite, it takes fault-bindings.xml for both Policy and Bindings file. In that case, click on your composite.




Go to Source tab




If you can check the Property values, you see fault-bindings.xml for both Policy and Bindings file. (If everything is correct, don't change anything)




You need to change it as below. Set "oracle.composite.faultPolicyFile" property value to "fault-policies.xml" when you see it as "fault-bindings.xml".




Happy learning. Cheers!!

Featured Posts

Sample Real Time Assignment in Oracle SOA