Monday, January 27, 2020

Difference Between call-template and apply template in XSLT

xsl:apply-templates is usually (but not necessarily) used to process all or a subset of children of the current node with all applicable templates. This supports the recursiveness of XSLT application which is matching the (possible) recursiveness of the processed XML.

xsl:call-template on the other hand is much more like a normal function call. You execute exactly one (named) template, usually with one or more parameters.

<xsl:call-template> is almost like  calling a function in a traditional programming language. We can define functions in XSLT like  below : simple example that prints the output as a string.
<xsl:template name="PrintAdd">
  <xsl:text>Printing current address</xsl:text>
</xsl:template>
This function can be called via <xsl:call-template name="PrintAdd"><xsl:apply-templates> is a little different one but  it is the real power of XSLT: It takes any number of XML nodes (whatever you define in the select attribute), iterates them ( apply-templates works like a loop!) and finds matching templates for them:
<!-- Example -->
<xml>
  <INDIA /><US/><aus/>
</xml>
<!-- Example -->
<xsl:template match="XML">
  <xsl:apply-templates select="*" /> <!-- three nodes selected here -->
</xsl:template>

<xsl:template match="INDIA"> <!-- will be called once -->
  <xsl:text>INDIA element encountered</xsl:text>
</xsl:template>

<xsl:template match="xml/*"> <!-- will be called twice -->
  <xsl:text>other element countered</xsl:text>
</xsl:template>

This way you can give a little control to the XSLT processor - not you decide where the program flow goes, but the processor does by finding the most appropriate match for the node it's currently processing.

Oracle Integration Cloud Interview Questions and Answers

1.what is main difference between SOA and OIC?

Ans:a)On_premise vs cloud
        b)more activity's compare to OIC
        c)now stability more compare to OIC(as per my experiences)
        d)we can do complex logic in SOA,but OIC not possible
        e)In SOA at time will call number of operations vs at time will call only one operation 
        f)Compare to SOA,OIC monitoring easy.
       g)deployment also easy in OIC,compare to SOA
2.When will you use SOA &OIC?

Ans: SOA- On-premise(complex code will go to SOA)
        OIC-Cloud(Simple code will go to OIC)

3.How can schedule the OIC integrations ?

Ans:We can use Scheduled Orchestration

4.What is the use of the Ical expression in OIC?

Ans:We can use Scheduled Orchestration

5.what is the use of stage activity?

Ans: OIC location to read data in file location

6.what are the operations in stage activities?

Ans: a)List files
        b)Read files in Segments
        c)Read Entire file
        d)Unzip file
        c)Write file
        d)Zip file

7.How can you download the files from On_premise  server to cloud OIC?

Ans:We can use FTP Adapters(List files, Read files in Segments,Read Entire file,Write file,Download file,delete files)

8.what is main difference between  Connectivity Agent and  Executive Agent?

Ans:

9.How many adapters you have worked on OIC?

Ans:SOAP,REST,EBS,GTM,FTP,SIBEL,ERP Cloud etc.

10.what are the activities are available in OIC?

Ans:Data-Assign,Map,Stage file.
       Call:Integration,java script,process.
       Collection:For each,Scope,Switch,While
       General:logger,Note,Notification
       End:Re-throw fault,Return,Throw New fault,Stop
11.what is main difference between SOAP and REST?
Ans:
        Rest-a)Limited resources and bandwidth
                b)Statelessness
                c)ease of coding
                d)performance more
        SOAP: a)Only XML format
                    b)stateful operation
12.What is the use of lookups in OIC?

Ans:we can pass any value dynamical, have to use lookups in OIC,without  touch to Code.

13.what are the integration style patterns ?

Ans: a)App Driven Orachestration
        b)Scheduled orachestration
       c)File Transfer
       d)Basic Routing
       e)Publish TO OIC

14.How can you connect On-premise application from OIC?

Ans: we use Agent to connect On-premise applications.

15.Which agent we have to select to connect on-premise application?

Ans:Connectivity agent

16.What type of error handler  your following in OIC?

Ans: In OIC error handler  we can use global fault option.

17.How many levels you can handling error in OIC ?

Ans: we can handling two levels.
           a)Scope level
           b)Global level
18.what is the web service response time in OIC?

Ans: 240 sec

19.How can you check logs in OIC?

Ans: In Dashboard, downloading logs  option is there, we can go to dashboard download that log files.

20.I have a huge file ( around 10 GB) which comes as an output of a REST API call.
This is a zip file.
Is it possible to write file in chunks in OIC?

Ans:Yes,We can achieve.. First we have to store the ZIP file in one location then unzip it.. you can store the data into multiple files with chunks..
using while activity we can loop over the records and store it into one location.



         


Sunday, January 26, 2020

Use case Scenarios File and FTP in OIC

Now let us look at a few example scenarios to see where these above mentioned “activities” can be used to design solutions. Here are some example scenarios

1. A source file of inventory records to be read from FTP and each record to be updated in target system using SOAP webservice

FTP Structured Read File:
This can be done using FTP Read File with schema of inventory record specified. For-Each construct can loop through each record to map to soap message and invoke soap webservice per record. Here is how it looks.
2. Accept a pdf file from source FTP and upload to a SOAP webservice as MTOM attachment

FTP Opaque Read File – SOAP MTOM:

FTP Read without specifying a schema will do the trick with opaque files. A FileReference object is available for mapping to target endpoint request.


FileReference can be mapped directly to the MTOM attachment, as shown below

3. Read a HDL file from vendor FTP and load it into Oracle Fusion HCM using UCM webservice as inline attachment
FTP Opaque Read File – SOAP inline attachment

The integration flow would look similar to Scenario.2 above.
The difference is in the mapping. The target UCM Webservice, in this case, expects an inline (base64encoded) attachment.
encodeReferenceToBase64 function converts File content to base64encoded string suitable for SOAP inline attachments
4. Read a zip file containing images and upload each image to a REST service as binary payload

FTP Download Unzip and Stage
The solution looks as above. The FTP Download file option with Unzip should be used.
Stage List activity and For-each can then be used to traverse through each image and post it to the REST service as raw payload (application/octet-stream) using the Generic Rest adapter
Stage List activity and For-each can then be used to traverse through each image and post it to the REST service as raw payload (application/octet-stream) using the Generic Rest adapter.
Same approach can be used even if passing the image file as multipart attachment.
5. Read a large file from FTP and process all records to a target database or ERP system
FTP stage Segment:
In this scenario we are assuming a file size of ~500MB. So using FTP Read is not recommended, the file would need to be downloaded using FTP “download file” option. Once the file is in Integration cloud file system, Stage option of “Read entire file” cannot be used as the file is larger than 10MB
Use the Segment Read option of Stage activity
Figures below show configuring “CRUD” operations on ERP Connection and choice of Business Object
A structured mapping like below helps map the read segment records into ERP payload
6. Read records over multiple REST calls, aggregate in local file and transfer file to remote FTP server
Aggregate file write
We have seen use cases for use of Stage Read and Stage Segment read. This scenario will show the utility of Stage Write file activity
The figure below shows a possible solution. REST endpoint calls are made within the while loop. Every response record is appended to a local file on Integration cloud using Stage File Write operation with an append option.

At the end of this file aggregation, Stage List Files operation is used to obtain a FileReference to this local file. Finally FTP Write or File Write can then be used to transfer the file to remote server.
Notice the use of the mapping function to convert FileReference to binary content, since we our remote Write file uses opaque schema.



FTP and File interview questions and answers in OIC

1.Since OIC is a PaaS offering, there has been checks on the file sizes that can be read with FTP Adapter. OIC limits the largest file that can be read in-memory using FTP Adapter to maximum of 5 MB.

2.Fortunately, OIC has ability to chunk read the large source file. This feature is called the Stage Read. Stage Read is a map reduce feature within OIC. Prior to making use of Stage Read in the OIC flow, one must make sure to download the file locally to OIC where OIC can read the file in chunks. The reason why the file must be downloaded to OIC prior to chunk reading it is because chunk reading from FTP Server is very expensive.

3.FTP Adapter in OIC does support the minimum age property but sometimes the source application may be trying to append to data file if there were many records. So using minimum age may not work in such scenarios and hence the need of having a trigger file.

4.How do we read large files upto 1Gb?
Ans:The ‘Read file’ approach is fine for files upto 10MB in size. However, Integration Cloud does not allow loading files larger then 10MB into memory for performance reasons. For reading larger files, developers should use the “Download file” option of FTP Connection. This allows file to be directly downloaded into ICS local file system without reading into memory.
FTP download can be used for files upto 1GB in size!
Once the file is available within Integration Cloud, then the Stage activity with operation ‘Read file in Segments’ can be used to perform chunked processing of the file contents.
Stage ‘Read file in Segments’ allows us to specify the segment size, in number of records, to process say 20 or 50 records per read cycle. The stage activity along with parallel processing option provides further enhanced performance.

5.Where can we decrypt a file?
Ans:Decryption can be done during 'download file' option of FTP Connection. Since ‘download file’ does not read contents into memory, the file read is effectively an opaque file. (no schema can be supplied during download file). But once the file is downloaded and decrypted, we can use the now familiar Stage read or segment read operation to read the structured data within the file.

6.When can we encrypt a file?

Ans:Encryption can be performed during “Write file” option of FTP Connection. Note that both structured and opaque file can be encrypted! Choose the “enable PGP Security” as shown below

Note Note that encryption and decryption are currently available only on FTP Connection. The encryption and decryption keys should be provided in FTP connection used.
Encryption and Decryption are planned in other adapters like SOAP and Fusion HCM.

7.How can we read a structured file ?
Ans:Files from source FTP or File server can be read into Integration Cloud as a structured file or as an opaque file. Structured files can be xml, json or a simple comma separated file (csv).
These could be a list of invoices, employee records in XML or json format which have a defined structure. Read file operation of FTP (and File) can read records from such files. The schema (or structure) can be specified by providing a schema file (xsd). Integration cloud can also generate a schema file using sample XML, JSON or CSV file, when the developer does not have the schema file.
The Read File operation reads the records from source file into memory. Subsequent mapper activities will present the schema structure allowing developer to map required values as required by the integration flow.
Figure below shows a mapping of structured elements
8.How can we read images and pdf files?
Ans:Consider a scenario when source file from FTP is a pdf file of a contract or a zip file containing jpeg images of inventory items. These are examples of opaque files. No Schema is provided during modelling and the file is read as opaque into memory. Figure below shows configuration to read an opaque file.

The output is available as a FileReference. Mapper activity allows us to map these file references to target systems. The target maybe another FTP server or a SOAP webservice which requires the image payload in base64encoded format.
Figure below shows a mapping of FTP FileReference
There is a special purpose function available in ICS, which can take a FileReference as input and convert the contents of the file into base64encoded string. This is the encodeReferenceToBase64 function we have seen earlier.
Note that SOAP connection also supports MTOM attachment which is more performant. When talking to SOAP service that accepts MTOM attachments, the FileReference can be directly assigned (or mapped) to the MTOM attachment of SOAP operation. There is no need of the base64encoding function in this case. See below figure showing SOAP adapter invoke configured with MTOM attachments option.

Tuesday, January 21, 2020

Create SOAP and REST Connection in Oracle Integration Cloud Service

SOAP Connection:

Steps to create SOAP Connection in Oracle Integration Cloud Service using external WSDL file :


ICS provides a SOAP adapter that allows us to create a SOAP connection with an external WSDL file.

Prerequisites :

External WSDL file or sample WSDL file such as below ( The Schema should be part of the WSDL, OIC does not support separate schema file configuration).

<?xml version="1.0" encoding="UTF-8" ?>
<definitions targetNamespace="urn:HelloWorldWSDL" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:HelloWorldWSDL"
             xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:ex="http://www.example.org">
  <types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org"
            targetNamespace="http://www.example.org" elementFormDefault="qualified">
  <xsd:element name="request">

    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="request" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="response">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="response" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="fault">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="error" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
  </types>
  <message name="HelloWorldServicePort_request">
    <part name="part" element="ex:request"/>
  </message>
  <message name="HelloWorldServicePort_response">
    <part name="part" element="ex:response"/>
  </message>
  <message name="HelloWorldServiceFault">
    <part name="part" element="ex:fault"/>
  </message>
  <portType name="HelloWorldServicePort">
    <operation name="HelloWorldOperation">
      <input message="tns:HelloWorldServicePort_request"/>
      <output message="tns:HelloWorldServicePort_response"/>
      <fault name="HelloWorldFault" message="tns:HelloWorldServiceFault"/>    
    </operation>
  </portType>
</definitions>

1. Click on Connections from Designer View in Oracle Integration Cloud Service.

2.Click on Create.

3. Search for SOAP Adapter -> and Select the SOAP Connection.


4. Enter below information and click on Create button
  •                 Name: Any meaningful name of your choice
  •                 Identifier: Identifier would be picked up automatically from                                        the  Name, however, we can update this
  •                  Role: Select Trigger and Invoke
  •                  Description: Optional description
5. Click on Configure Connectivity and upload the WSDL url file. ( Sample WSDL is attached above, save it as HelloWorldService.wsdl) and use it to upload.

6. Next, Click on Configure Security and enter the ICS login credentials ( username and password). Click OK after entering the credentials.

7. Next the Connection configuration page will show Progress as 85 % 


8. Click on Test -> Validate and Test . If the credentials and the WSDL file is valid, the connection configuration page will show that the test was successful and progress will be 100%

REST connection:
Below are the simple steps to create REST connection

  • Login to the ICS console
  • Move to the home page
  • Click on Connection


  • Click on the Create button from the upper right corner

  • Search REST and select REST Adapter
  • Enter Name as TEST_REST_Conn and select Trigger from Role type drop down. We have selected Trigger as we want to expose this REST connection as a REST service. Means this will work as an endpoint for the end user
  • As this is the Trigger REST connection, you don’t need to configure anything in this. Leave all as it is. And click on Test button in the upper right corner. If everything goes fine, the progress bar will reach 100%
  • Click Save and Close button from the upper right corner

Monday, January 20, 2020

Oracle E-Business Suite Adapter in Oracle Integration Cloud Service

          The Oracle E-Business Suite Adapter is one of the most popular adapter in Oracle Integration Cloud Service. Oracle E-Business Suite is commonly used in most of the big organization and all they all want to communicate EBS with all the applications running in the organization.
          The Oracle E-Business Suite Adapter is one of many predefined adapters included with Oracle Integration Cloud Service allowing us to securely connect and use Oracle E-Business Suite services in integrations in Oracle Integration Cloud Service.
Capabilities of EBS adapter
  • Support inbound and outbound integrations
  • It is used to call PL/SQL API
  • The Oracle E-Business Suite Adapter supports outbound integrations with concurrent programs from Oracle Integration Cloud Service when adding the Oracle E-Business Suite Adapter as invoke (target) connections.
  • When Oracle E-Business Suite Adapter used as trigger (source) connections, business events are available for inbound integrations in Oracle Integration Cloud Service.
  • Similar to business events, XML Gateway messages are available for inbound integrations in Oracle Integration Cloud Service when adding the Oracle E-Business Suite Adapter as trigger (source) connections.
In this article, we’ll show how to create EBS connection in Oracle ICS with On-Premise E-Business Suite.
Pre-requisite
  • EBS should be up and running
  • EBS console credentials
  • Required ports should be open between ICS agent and EBS: This is required if EBS suite resides in organization premises.
  • ICS agent should be up and running
Let’s consider we already have all pre-requisite in place, so let’s move ahead and create a EBS connection.
  • Login into the Oracle ICS
  • Select Connection tile from home page and select Create button from upper right side corner
  • Search Oracle E-Business Suite and Select the adapter
  • Enter below information and click Create button
    • Enter Name
    • The identifier would be automatically picked up based on name entered however we can edit it.
    • Select Role as Trigger and Invoke depending on the requirement.
    • Enter Description
  • Select Configure Connectivity button and enter below information and click OK button
    • Enter EBS Connection URL
  • Select Configure Security button and enter below information and click OK button
    • Select Basic Authentication from Security policy drop down
    • Enter User Name
    • Enter Password
    • Enter Confirm Password

  • Select Configure Agent button, select the Agent group from the popup and click Use button
  • Now Click Test and Save button from the upper right corner

If everything goes fine, the progress bar will reach 100 %.