Monday, June 30, 2014

SOA 11g - Unable to get schema information for target

Sometime when we use tranform activity inside BPEL, we face below error.

Error: “Unable to get schema information for target or source”.



Above error occur when we use two schema with same namespace in our code.

Resolution:

We generally use “Import” tag inside WSDL to refer schema. So if you still use “import” tag to refer two schema having same namespace then you will get above error.



To resolve this error, we need to use “Include” tag instead of “Import” tag inside WSDL file. You need to make below changes as shown in below figure.



By Vivek Garg- 6/30/2014



Friday, June 27, 2014

OSB 11g - File Listing In Oracle Service Bus

Many people wonder why there is no option for file listing in Oracle Service Bus and this is something mostly used when we needs to read multiple files in loop. This post will explain how we list files in OSB.

OSB has file protocol which we can use to read the file but we don’t see any option available to list files. In SOA when we use file/ftp adapter and there we have file listing option which we can use to list the files and this option is not available in OSB with default file protocol.

Trick here is that we will use same SOA file/ftp adapter in OSB to list the files. we will perform below steps to do file listing.
  • Create file/ftp adapter in Jdeveloper and choose file list option
  • Import adapter JCA & WSDL file to OSB project
  • Generate business service from adapter JCA file

Let’s see how this works.

First open your Jdeveloper, create a SOA composite. Drag file adapter if you need to list files from local system or drag ftp adapter if you need to list files from remote server.

Name your adapter and choose “List Files” option. Provide Physical path, file name and save the adapter.


You will see one JCA and one WSDL file created, you need to import both the files to OSB project.

Before that you need create one OSB project in eclipse.

Right-click on JCA file and go to “Oracle Service Bus” à”Generate Service”, then choose the folder where we want to create the business service.

Once you complete the above step, you will see one business service file and one wsdl file in that folder.




Now deploy your OSB project to OSB server and test it.

Testing Result:

To test it place couple of files in required location and test your business service. You should see list of all the files.






By Vivek Garg - 6/27/2014

Please do not copy content of this post.


SOA 11g - Pick Activity Use case - 2 - Multiple Entry point for Composite

In my previous post, I discussed about first use case for pick activity (When we call asynchronous service and we need response back in certain time frame otherwise we need to throw exception).
In this post, I will discuss about second scenario and show one use case of that.

In this scenario, we will have more than one entry point to same composite i.e. same composite can be invoked either by web service call or through JMS queue.

For this post, you need to add two services in the composite, one for web service and other for JMS Queue.

Add a BPEL process to the composite and wire both the services to the BPEL.


Now open BPEL process and drop Pick activity to it. Since we have two entry points for this composite so add one more OnMessage branch to it.

Make sure you select “Create Instance” box for that pick activity so that it can create BPEL instance, if you don’t check this option then you will not be able to compile your code.



Now go to first OnMessage branch and add partner link reference.


Do same steps for second OnMessage branch.


Once done, add required activities in both the branches. If you don’t add any activity inside any of the branch then you will not be able to compile your code.
Now deploy your composite.

Testing Result:

Let’s first test by web service call, go to EM console and test the composite. To test second entry point put message to JMS queue.




By Vivek Garg - 6/27/2014

Please do not copy content of this post to your blog.


SOA 11g - Pick Activity Use Case 1- Get Response from Asynchronous Service Or TimeOut

In my previous post, I explained about pick activity and also explained where we can use this activity in BPEL. Below are the two scenarios where we can use pick activity.
  •  When we call asynchronous service and we need response back in certain time frame otherwise we need to throw exception.
  • When we want to have multiple entry point for any composite. E.g. when we want our process when it is invoked by client or when any message is put to JMS queue by client.

In This post, I will discuss about first scenario and show one use case of that.

In this scenario, we call one asynchronous service which provides response in certain time frame, if that service is not able to provide the response in that time period then we need to throw time out error and stop the processing.

First create an asynchronous service and deploy it to SOA server.

Now create a new composite and add BPEL component to it.  From this composite, we call asynchronous service so we need to add asynchronous service reference in the composite, once asynchronous service reference is added, wire it to BPEL.



Now open your BPEL process and add “Invoke” activity inside it to call asynchronous service.

Add a pick activity after the Invoke; this pick activity has two branches. First branch is “OnMessage” and other is “OnAlarm”. Click on Pick activity and add “OnAlarm” branch also.

Make sure that “Create Instance” box in unchecked for pick activity as we don’t want to create any instance, we just want to get the response back from asynchronous service.



Let’s first talk about OnMessage branch, this branch is used to get the response from asynchronous service. This branch act like a receive activity. Click on OnMessage branch and choose the reference service partner link.

In OnAlarm branch, we specify the expiration time which means if we get the response from asynchronous service within specified time then control will go to OnMessage branch and we successfully retrieve the message and if asynchronous response time exceeds specified time than control will go to OnAlram and whatever activities we have added there will execute.
Below is the final flow of the BPEL.




Now deploy this composite and we test both OnMessage and OnAlarm branch.

Let’s first test OnMessage branch, as shown in below screen shot, asynchronous service provided the response within specified time limit so control goes to OnMessage branch.


Now let’s test OnAlarm branch. For this we have added some wait inside asynchronous service so that when first composite call asynchronous service, asynchronous takes more than specifies time.







By Vivek Garg - 6/27/2014

Please do not copy content of this post to your blog.

Wednesday, June 25, 2014

Oracle SOA Interview Question and Answers (Performance Tunning) Part - 9

This is Chapter-9 of Oracle SOA interview questions and answers series.



Question: What is difference between Transient and Durable processes?

Answer:  Below is difference between Transient and Durable process
Transient Process: Transient processes do not incur dehydration during their process execution. If an executing process experiences an unhandled fault or the server crashes, instances of a transient process do not leave a trace in the system.
Durable Process: Durable processes incur one or more dehydration points in the database during execution. Dehydration is triggered by one of the following activities:
·         Receive activity
·         OnMessage branch in a pick activity
·         OnAlarm branch in a pick activity
·         Wait activity Reply activity
·         checkPoint() within a <bpelx:exec> activity




Question: Can we set audit level at BPEL level?

Answer: Yes, we can use bpel.config.auditLevel property inside composite.xml file for BPEL process service component to set audit level for BPEL. This property takes precedence over audit level settings at the SOA Infrastructure, service engine, and SOA composite application levels.
<component name="BPELProcess">
<implementation.bpel src="BPELProcess.bpel" />
<property name="bpel.config.auditLevel">Off</property>
</component>



Question: What are disadvantages of Asynchronous process?

Answer:  It adds dehydration overhead. This can become a problem if there are large numbers of asynchronous processes waiting for a response since for every callback, a new thread/transaction is needed and a callback needs to be matched to a correlation table which takes longer if there are a lot of open processes. Design processes to be synchronous as much as possible, avoid nesting of asynchronous processes also avoid synchronous processes calling asynchronous processes.


Question: Does Oracle recommend batch processing?

Answer: No, we should avoid batch processing in BPEL as much as we can.  Batch processing takes lot of memory and causes a lot overhead for storing audit information. We should put the work to be done in a separate BPEL process and optimize this process. Design for worst case scenarios. Implement retry mechanisms in fault-policies. Implement your own scheduling mechanism to spread the load, if no message level processing is needed, ODI might be an option.



Question: What is idempotent activity?

Answer: An idempotent activity is an activity that can be retried.
This property has the following values:
·         False: Activity is dehydrated immediately after execution and recorded in the dehydration store. When idempotent is set to False, it provides better failover protection, but may impact performance if the BPEL process accesses the dehydration store frequently.

·         True (default): If Oracle BPEL Server fails; it performs the activity again after restarting. This is because the server does not dehydrate immediately after the invoke and no record exists that the activity executed. Some examples of where this property can be set to True are: read-only services (for example, CreditRatingService) or local EJB/WSIF invocations that share the instance's transaction.



Question: What is nonBlockingInvoke property?

Answer: This property is used when we use Flow or Flow N in BPEL. By default, Oracle BPEL Process Manager executes in a single thread by executing the branches sequentially instead of in parallel. When this property is set to True, the process manager creates a new thread to perform each branch's invoke activity in parallel. This property is applicable to both durable and transient processes.



Question: What is streamResultToTempFile property in Mediator?

Answer: Until 11g Release 1 11.1.1.3, for XSLT operations in Oracle Mediator, the result was cached into memory as a whole document in binary XML format. For large document processing, this caused out-of-memory errors. Starting with 11g Release 1 11.1.1.4, the streamResultToTempFile property is available. This property enables XSLT results to be streamed to a temporary file and then loaded from the temporary file. Set streamResultToTempFile to yes when processing large payload using XSLT. The default value is no.
<component name="Mediator1">
   <implementation.mediator src="Mediator1.mplan"/>
   <property name="streamResultToTempFile">yes</property>
</component>

This property is recommended only for processing large payloads. Enabling this property could reduce performance for normal payloads.



Click here go to Chapter-8                                                       Click here to go to Chapter-10





SOA 11g - Delay In Oracle AQ Adapter

In AQ adapter, we have many properties and one of it is “delay”. This property is used when we don’t want to make the message visible to outside world for some time. Message is visible and ready to read once that delay time expire message.

We can set this property at adapter level in Oracle SOA suite. In this post, I will show you how to use this property inside AQ adapter.

Create AQ adapter and configure it. Add Invoke activity inside BPEL and wire it to AQ adapter.

Create a variable with name delay or you can choose any other name and assign value to it. Here we have assigned 10 minute delay.



Then go to “Properties” tab of that invoke.



 Assign delay variable which we created above.


Once you test above adapter then you can check the en-queue and delay column in AQ table.






Tuesday, June 24, 2014

SOA 11g - Not Able to Subscribe To Oracle Apps Event or Not Able to De-Queue Message From AQ

In Oracle SOA Suite, we have Oracle Apps adapter which is used when we need to subscribe to Oracle apps business event.

When oracle fires that business event, message came to “WF_BPEL_Q” and you can see the message in “WF_BPEL_QTAB” table.

Someone of us face issue that they are not able listen to that event i.e. they are not able to de-queue the message from BPEL queue.

Below are the possible reasons for that.

  • User which you are using to read that event don’t have sufficient privileges
  • Using wrong JNDI name in Adapter
  • Below is a major reason most of the times:


 When we use oracle apps adapter to listen to business event then it make subscription entry in “AQ$WF_BPEL_QTAB_S” table and in JCA file we see one property with name consumer. So Consumer property value should match with NAME column in table.




Subscription entry in this table will be based on SOA service i.e. if we are having two SOA service listening to same event then we will have entries in this table, one entry for each service.


This entry is made in the table when we configure adapter in SOA but we migrate same code to next environment then we manually need to make this entry.

Friday, June 20, 2014

Oracle Service Bus Interview Questions and Answers Part - 5

This is Chapter-5 of OSB interview questions and answers series.


Question: What is Service Result caching in OSB?

Answer: Service Result Caching is one of the options that you can use when you want to improve Oracle Service Bus performance. Service Result caching is used when we have business service which connects to external service which returns somewhat static response. So by using Service Result Caching we don’t hit external service for same request instead it will take the response from cache which improve the OSB performance
For more details, you can refer my below post.



Question: How to perform Service Callout in OSB?
Answer: 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

Refer below post for more details.


Question: When we invoke proxy 2 from proxy 1 then which protocol we need use?
Answer: When there is internal proxy call in OSB then we use “local” transport instead of HTTP.


Question: What is content based routing in OSB?
Answer: When we route the request message to different business services based on request message content, that is called content based routing.


Question: What are different options available in OSB to read flat file?
Answer: We can read flat file in two different ways.

·         Using MFL: we can MFL in OSB to read flat files. For more details refer my below post


·         File Adapter: Create file adapter which read flat file in Jdeveloper, copy JCA, WSDL & XSD file of file adapter in OSB and create proxy service which will read that flat file.


Question: What is SLA alert in OSB?
Answer: A service-level agreement (SLA) is a contract between a service provider and a service consumer. In OSB monitoring framework we have SLA alerts which come into picture when there is violation of service level agreements.

For more details refer my below post



Question: How to move large file without reading it in OSB?
Answer:  In Oracle SOA Suite we use “Move” opeartion to move large files from one location to another. But in Oracle Service Bus we don’t have that option available. But we can use Content Streaming option avaiable for file protocol in OSB to move large files.

For more details refer my below post





Click here to go to Chapter-4          




Oracle Service Bus interview Questions and Answers Part - 4

This is Chapter-4 of OSB interview questions and answers series.


Question: What is Service pooling in OSB?

Answer: In OSB we can group together more than one service so that whenever one service goes down, request will route to next available service and end user can continue his work without any interruption.

For more details, you can refer my below post.

http://soawork.blogspot.com/2014/06/service-pooling-in-osb.html 


Question: How file pooling works in OSB?
Answer: There are below two ways to poll a file in OSB.

·         Use OSB file protocol: We can use file protocol available in proxy service to poll the file. Refer below post for more details.


·         Use File adapter: we can create file adapter in Jdeveloper and import JCA, WSDL & XSD file of that adapter into OSB and generate proxy service from that.


Question: Types of pipeline available in OSB?
Answer: We have two pipelines in OSB, Request and Response pipeline.


Question: Can we invoke Restful service from OSB?
Answer: Yes, we can invoke Restful service from OSB. For more details refer below post.



Question: When we use service Account?
Answer: We use Service Account when we are invoking a service which required static authentication.


Question: We don’t have any DB protocol in OSB then how to read/write data from database using OSB?
Answer: We can use database adapter to read/write data from database. We can create database adapter in Jdeveloper, import adapter JCA,WSDL & XSD files to OSB and generate proxy or business service as per our requirement.


Question: How to perform file listing in OSB?

AnswerTo perform file listing in OSB, you need to create file adapter with file listing operation in Jdeveloper and use that only.



Click here to go to Chapter-3                                                Click here to go to Chapter-5