Thursday, 31 August 2017

Customizing Oracle Service Bus Environments- deployments

In Oracle 12c IDEs for Service Bus has been integrated in JDeveloper. The development of Service Bus services looks very much like the development of SCA Composites.
But unlike a SOA project where a config plan can be generated for the project in jdeveloper, No such option exists for OSB projects. I came across a scenario in OSB, where I wanted to change a webservice url before deploying to another environment, which is a very common requirement. Here I  am going to discuss the environment values and how to change them from OSB console.
Environment Values
Environment values represent data in the Service Bus configuration that are likely to change when you move your configuration from one domain to another (for example, from test to production). These are predefined fields, and environment values correspond to the properties you configure when you create a service or resource for Service Bus.

Environment values represent entities such as URLs, URIs, file and directory names, server names, email servers, and so on. A good example is the URL of a proxy service, which changes depending on the physical location of the domain. Some of the environment values are listed below

Environment Value
Found In
Description
Service Retry Count
Business service
The number of times endpoint URIs are retried for a business service; in other words, the number of failover attempts.
Service Retry Iteration Interval
Business service
The length of time that a business service waits before iterating over the entire set of URIs again.
Service URI
Proxy or business service
Proxy or business service URI. This variable includes a location in the configuration file. The location is not defined for proxy services.
Service URI Weight
Business service
The individual weights assigned to business service URIs. This variable includes a location in the configuration file.
Proxy Server Host
Proxy server
The host name of a proxy server in a proxy server resource. This variable includes a location in the configuration file.
Proxy Server Port
Proxy server
The port number of a proxy server in a proxy server resource. This value is an integer. This variable includes a location in the configuration file.

There are two ways to update environment values in a domain

a) Find and Replace

you can search for environment values in a domain and view a list of matching values
I have created a  simple OSB project to demonstrate the same.

                                 



Here the endpoint url of business service changes with respect to the environment where the OSB project  is to be deployed.

We can replace this url from OSB console by following below steps
1) Log into Oracle Service Bus Console .If you are in a session, you can find and replace environment values. However, if you are outside a session, you can only find environment values

2) click the Admin tab, and then click Find and Replace.


3) The Find and Replace dialog appears.
     In the Find Value field, enter the environment value that you want to find.
     You can enter a partial value in this field.
     In the Variable Type list, select the type of environment value for which to search. To locate environment values located in a particular project, select the project name from the Project list. Click Find.





A list of matching values appears on the Find and Replace Results tab at the bottom of the page

4) In the Replace with field, enter the new environment value that will replace the value you entered in the Find Value field. click Replace..All occurrences of the value you entered in the Find Value field are replaced with the environment value you entered in the Replace with field in the current session.



5) To end the session and deploy the configuration to the runtime, click Activate.


b) Configuration Files
Configuration files are XML-based files that define environment values, operational settings, and reference mappings used by Service Bus. Because they are XML-based, you can easily m0odify a generated configuration file.

1) On the Oracle Service Bus Console, select the Admin tab, and then click Create Configuration File.
The Create Configuration File page appears with a list of objects in your configuration.
  2) Select the projects or resources you want to include in the configuration file.

  3)Click Create.
  4) In the File Download dialog box, click Open to open the file or click Save to save the file to your local machine.

In an XML editor, use the customization schema in conjunction with the base configuration file you created to make the necessary modifications to resources and environment variables.

Executing a Configuration File

Once you create a configuration file and update the values for the new domain, you can execute the file that was previously saved on your system. You must be in a session to execute a configuration file.
To execute a configuration file:
  1. click Execute Configuration File.
  2. Click Browse, and navigate to and select a configuration file to execute.

  1. Review all changes listed in the summary to be sure they are correct.
  2. Click Finish to commit the updates in the current session.

To end the session and deploy the configuration to the runtime, click Activate

Wednesday, 30 August 2017

SOA - Multiple IN parameters in DB adapter


I came across a scenario, where I had to select data from a table using multiple parameters passed IN parameters.

When select operation is used in DB adapter , IN operator  is not available in the list of operators.That leaves me with the option of execute pure sqloperation.




Here schema gets generated on the basis of the query entered in SQL section where parameter EMPID appears to be a single element. This does not solve my purpose as I want to pass multiple employee Ids. Even when I define param element as maxOccurs=‘unbounded’, query only considers the first value. That means each #param becomes a bind variable in the query. You can't provide a list of values.


I found an approach to circumvent this by handling the multiple parameters at DB end.Following is the scenario

 1) Create a new SOA project with a synchronous BPEL

      2) Change the xsd of BPEL to conform to below structure. Here we aim to fetch employee details from the table on basis of one or more emp ids passed as the input to the composite.


      3) Create table as shown below


  
     4) Configure the DB adapter as below.

             Select Exceute pure sql operation


               In the next step enter the below query

SELECT EMPLOYEE_ID,EMPLOYEE_Name,EMPLOYEE_Dept from EMPLOYEE_Details WHERE  EMPLOYEE_ID IN (SELECT SUBSTR (DELIMITED_INPUT_STRING , DECODE(LEVEL, 1, 1, INSTR(DELIMITED_INPUT_STRING, DELIMITER, 1, LEVEL-1)+1) , INSTR(DELIMITED_INPUT_STRING, DELIMITER, 1, LEVEL) - DECODE(LEVEL, 1, 1, INSTR(DELIMITED_INPUT_STRING, DELIMITER, 1, LEVEL-1)+1) )   FROM (SELECT #InputString || #Delimiter1 AS DELIMITED_INPUT_STRING ,  #Delimiter2 AS DELIMITER FROM DUAL)  CONNECT BY INSTR(DELIMITED_INPUT_STRING, DELIMITER, 1, LEVEL)>0)

where
#InputString - Your Input String with delimiters (but no spaces) e.g. '11111,11112,11113’
#Delimiter1 - Assign the delimiter e.g. ','. This is to suffix above string with same delimiter.
#Delimiter2 - Assign the same delimiter e.g. ','


                  Click  on finish


5)  Once the DB adapter is configured our composite looks like this


                                      


6) In the BPEL,drop a invoke activity and create required input and output variables

                                           

      7)  Assign the parameters with delimiters (but no spaces) e.g. '11111,11112,11113’


I achieved the same by writing below XQuery which gave me the inputs in this pattern e.g. 11111 11112 11113 (separated by space)

declare variable $inputVariable.payload as element() (:: schema-element(get:process) ::) external;
declare variable $Inparam :="";

declare function local:funcTransformation_getempdetails($inputVariable.payload as element() (:: schema-element(get:process) ::)) as element() (:: schema-element(dbr:dbReferenceInput) ::) {
    <dbr:dbReferenceInput>
        <dbr:InputString>
         {
        for $EmpIds in $inputVariable.payload/get:EmployeeIDS/get:EmployeeID
        let  $Inparam :=fn:data($EmpIds)
        return $Inparam
       }
                </dbr:InputString>
        <dbr:Delimiter1>{fn:data(',')}</dbr:Delimiter1>
 <dbr:Delimiter2>{fn:data(',')}</dbr:Delimiter2>
            </dbr:dbReferenceInput>
};


Drop assign activity and use translate function to replace spaces in parameters to ,
 This gives me the desired string 11111,11112,11113




RESULT

Details corresponding to each emp id passed into the composite are fetched from DB



HAPPY LEARNING!!!!

Tuesday, 29 August 2017

OSB-398016 Error loading the WSDL from the repository: Failed to read wsdl file from url due to -- java.net.MalformedURLException: Unknown protocol: servicebus

While running my OSB project on integrated weblogic server, I came across the below error


[OSB-398016] Error loading the WSDL from the repository: Failed to read wsdl file from url due to -- java.net.MalformedURLException: Unknown protocol: servicebus





I found out that it is a known bug.
Bug: 18856204
Cause: WSDL Errors Can Occur When Oracle Service Bus and Oracle Business Process Manager Are on the Same Domain

I came across this solution which worked for me


Steps

1) Login to weblogic console
2) In the domain structure panel select OSGi Fraemework from services node.

    An OSGi Framework provides an OSGi runtime environment to support applications which make use of OSGi features, such as packaging, lifecycle management, and an active registry



s

3) Click on the bac-svnserver-osgi-framework link
4) In the init properties text field at the bottom add felix.service.urlhandlers=false

  • ·         init properties- The properties to be used when initializing the framework. All standard properties and all properties specific to the framework can be set.
  • ·         felix.service.urlhandlers - Flag to indicate whether to activate the URL Handlers service for the framework instance; the default value is true. Activating the URL Handlers service will result in the URL.setURLStreamHandlerFactory() and URLConnection.setContentHandlerFactory() being called.





    5) Click Save
    6) Restart  Weblogic Server 


    HAPPY LEARNING!!!!

    Friday, 25 August 2017

    Installation of Jdeveloper 12c on windows

    Prerequisites

    Operating System -  Microsoft Windows 7, 8, 10 , Linux, UNIX, and Mac OS X (64bit).
    Oracle provides generic as well window specific installer. This tutorial uses generic installer for windows 10
    Java SE JDK - Oracle JDK 1.7 Update 51+ (64bit)

    Installation

    Step 1- Download and install the supported jdk

    JDeveloper 12.1.3 can be configured to develop/compile against JDK 8, and introduces support for JDK 8 language features. However, the JDeveloper process must be running with JDK 7. JDeveloper requires a full Java SE JDK (as opposed to JRE).
    Required version of JDK can be downloaded from here

    Download and install the setup.
    Post installation, jdk and jre folders are available as per your mentioned installation directory.


    Step 2- Download and install the Jdeveloper
    Following are the steps to be followed for installation
    1.  Jdeveloper 12.1.3.0 for generic platform can be downloaded from here
    2.  Run cmd as administrator.


    If cmd is not run as administrator,below error can be seen on cmd and installer will not be launched.
    Unable to access or modify the system registry. Select Run as Administrator when opening the Command Prompt and try again.


         3. Using command prompt, navigate to the bin of installed jdk



               4.  Launch the installation program by invoking java -jar , as shown below:


              5.  Now the quick start installer runs. Select the Oracle home directory. Click next


               6. Once the installer performs prerequisite check and click on install



         7. Click finish and launch the jdeveloper. Select studio developer role and get started with your first SOA/OSB application.








              8. In case you don't get the option to create a SOA application, you will be required to install SOA extension.

                      Click on Helpà check for updates 


                     In the search window select all check boxes and click next


    Select Extension SDK under IDE folder to install SOA extension. Click next to download



    HAPPY LEARNING!!!


    Demystifying getActiveUnitofWork property of DB Adpater

    Here in this I am going to discuss one of the interaction options available in Database adapter configuration, getActiveUnitofWork The p...