Thursday, June 11, 2020

XSD - Define a complex type using type attribute or directly by naming

Complex Element is an XML element which can contain other elements and/or attributes. We can create a complex element in two ways −
  • Define a complex type and then create an element using the type attribute
  • Define a complex type directly by naming

Define a Complex Type and then create an element using type attribute.

Here JobHistory element is referring to  JobType complex type using type attribute

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="" xmlns="" xmlns:ns0="" targetNamespace=""
  <xsd:element name="HREmployeeData">   
        <xsd:element name="First" type="xsd:string"/>
        <xsd:element name="Last" type="xsd:string"/>
        <xsd:element name="Phone" type="xsd:string"/>
        <xsd:element name="Income" type="xsd:double"/>
        <xsd:element name="Status" type="xsd:string"/>
        <xsd:element name="JobHistory" type="ns0:JobType"/>
    <xsd:complexType name="JobType">
        <xsd:element name="JobTitle" type="xsd:string"/>
        <xsd:element name="Salary" type="xsd:double"/>

Define a complex type directly by naming

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="" xmlns=""
            targetNamespace="" elementFormDefault="qualified">
  <xsd:element name="HREmployeeData">
        <xsd:element name="First" type="xsd:string"/>
        <xsd:element name="Last" type="xsd:string"/>
        <xsd:element name="Phone" type="xsd:string"/>
        <xsd:element name="Income" type="xsd:double"/>
        <xsd:element name="Status" type="xsd:string"/>
        <xsd:element name="JobHistory">
              <xsd:element name="JobTitle" type="xsd:string"/>
              <xsd:element name="Salary" type="xsd:double"/>

SOA 12c - Call Template to get a date format

Here we will see how to use template to get following date format.


In the XSLT :

In the main template use:
    <xsl:call-template name="formatDate">
        <xsl:with-param name="date" select="HIRE_DATE"/>

Called template:
<xsl:template name="formatDate">
      <xsl:param name="date"/>
      <xsl:variable name="year" select="substring($date, 8, 4)"/>
      <xsl:variable name="month" select="substring($date, 4, 3)"/>
      <xsl:variable name="day" select="substring($date, 1, 2)"/>
         <xsl:when test="$month='JAN'">
            <xsl:value-of select="concat($year,'-01-',$day)"/>
         <xsl:when test="$month='FEB'">
            <xsl:value-of select="concat($year,'-02-',$day)"/>
         <xsl:when test="$month='MAR'">
            <xsl:value-of select="concat($year,'-03-',$day)"/>
         <xsl:when test="$month='APR'">
            <xsl:value-of select="concat($year,'-04-',$day)"/>
         <xsl:when test="$month='MAY'">
            <xsl:value-of select="concat($year,'-05-',$day)"/>
         <xsl:when test="$month='JUN'">
            <xsl:value-of select="concat($year,'-06-',$day)"/>
         <xsl:when test="$month='JUL'">
            <xsl:value-of select="concat($year,'-07-',$day)"/>
         <xsl:when test="$month='AUG'">
            <xsl:value-of select="concat($year,'-08-',$day)"/>
         <xsl:when test="$month='SEP'">
            <xsl:value-of select="concat($year,'-09-',$day)"/>
         <xsl:when test="$month='OCT'">
            <xsl:value-of select="concat($year,'-10-',$day)"/>
         <xsl:when test="$month='NOV'">
            <xsl:value-of select="concat($year,'-11-',$day)"/>
         <xsl:when test="$month='DEC'">
            <xsl:value-of select="concat($year,'-12-',$day)"/>

SOA 12c - Transfer artifacts from Jdeveloper SOA Design time repository to MDS

In this post, we will see how we can transfer any artifacts from SOA Jdeveloper file based design time repository to MDS DB.

Follow the steps:

Step 1: Create a Local soamds folder structure.

Folder structures:
Step 2: SOA_DesignTimeRepository⇾Properties⇾browse the created soamds root folder⇾Test Connection
Step 3: Database ⇾New Database connection ⇾Provide SOA_MDS db connection details and test connection
Step 4:  Create SOA-MDS Connection ⇾choose the created mds db connection ⇾select mds partition as soa-infra⇾ test connection.
Step 5: SOA_DesignTimeReporistory⇾Transfer⇾select the artifacts to be transferred to MDS⇾Select the target DB connection⇾Transfer⇾If any artifact exists then overwrite prompt will come just overwrite ⇾Transferred done

Tuesday, June 9, 2020

SOA 12c - MDS - How to export and import MDS metadata in Em console

In this post we will see how to export and import MDS metadata from oracle enterprise manager console to the file system.

Login to Em console and click on SOA-Infra and MDS Configuration.

Select the option “Export metadata document to an archive on the machine where this web browser is running” and Click on Export.

Once after you press OK, it will take some time to export the meta data to a file.
If you open the file , it will show you fault policies, wsdl, xml schema and all configuration settings of your server.

Login to Em console and click on SOA-Infra and MDS Configuration.

Select the option “Import metadata documents from an archive on the machine where this browser is running ” and Click on browse to select the file and click on Import.

Monday, June 8, 2020

Database - Create a sequence

  • Sequence is a feature supported by some database systems to produce unique values on demand. Some DBMS like MySQL supports AUTO_INCREMENT in place of Sequence.
  • AUTO_INCREMENT is applied on columns, it automatically increments the column value by 1 each time a new record is inserted into the table.
Creating a Sequence

CREATE SEQUENCE sequence-name
    START WITH initial-value
    INCREMENT BY increment-value
    MAXVALUE maximum-value

Initial-value specifies the starting value for the Sequence.
Increment-value is the value by which sequence will be incremented.
Maximum-value specifies the upper limit or the maximum value upto which sequence will increment itself.
CYCLE specifies that if the maximum value exceeds the set limit, sequence will restart its cycle from the begining.
NO CYCLE specifies that if sequence exceeds MAXVALUE value, an error will be thrown.

Using Sequence:
Creating a sequence, which will start from 1, increment by 1 with a maximum value of 999.

Example 1:

INSERT INTO class VALUE(seq_1.nextval, 'anu');

Example 2:

select USER_EVENT_SEQ.nextVal from dual

For more details click here.Oracle Docs

loose coupling vs tight coupling

Tight Coupling:
  •  A Tightly Coupled Object is an object that needs to know about other objects and are usually highly dependent on each other's interfaces. When we change one object in a tightly coupled application often it requires changes to a number of other objects. There is no problem in a small application we can easily identify the change. But in the case of a large applications these inter-dependencies are not always known by every consumer or other developers or there is many chance of future changes.
  • Traditionally, connections between applications or between applications and services have been tightly coupled, as with CORBA (Common Object Request Broker Architecture).
  • Tightly coupled systems are usually fast and safe, and the risk of transmission errors is very low. 
  • Tight coupling tends to make component maintenance and reuse much more difficult, because a change in one component automatically means changes in others. Similarly, tight coupling makes extra work when an application has to adapt to changing business requirements, because each modification to one application may force developers to make changes in other connected applications.
Loose Coupling:
  • Loose coupling is a design strategy which allows us to reduce the inter-dependencies between components of a system with the goal of reducing the risk that changes in one component will require changes in any other component. It’s all about thinking a problem in generic manner and which intended to increase the flexibility of a system, make it more maintainable, and makes the entire framework more stable. 
  • One key feature of SOA is the use of loosely coupled connections.  
  • Loosely coupled systems, on the other hand, are usually more error-prone but also more flexible. 
  • Being loosely coupled enables you to keep moving forward, modifying/adding features, bugs fixing, etc.

Friday, June 5, 2020

Service orchestration vs Service Choreography

Service orchestration
  • Service orchestration represents a single centralized executable business process (the orchestrator) that coordinates the interaction among different services. The orchestrator is responsible for invoking and combining the services.
  • The relationship between all the participating services are described by a single endpoint (i.e., the composite service). The orchestration includes the management of transactions between individual services. Orchestration employs a centralized approach for service composition. 
  • WS-BPEL specification is an example. WS-BPEL is a language for defining processes that can be executed on an orchestration engine such as WSO2 BPS.

Service Choreography
  • Service choreography is a global description of the participating services, which is defined by exchange of messages, rules of interaction and agreements between two or more endpoints. Choreography employs a decentralized approach for service composition.

The choreography describes the interactions between multiple services, where as orchestration represents control from one party's perspective. This means that a choreography differs from an orchestration with respect to where the logic that controls the interactions between the services involved should reside.

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...