Sunday, 15 December 2013

Working with LIST FILE OPERATION in FileAdapter Oracle Soa 11g



 LIST FILE OPERATION

       List Files: List Files Operation lists file names in specified Locations.
     
           Create a SOA Project and provide project name as ListFiles



          As List files Operation is an outbound operation  , right click on external references select Insert-   >File Adapter.



    Provide Service Name as List Files and click on next


     Select interface as shown below and click on Next.


    Select Operation as ListFiles and click on Next.


    Browse for the folder where your files are present and click on Next.


      Provide the File Name with pattern Emp*.txt, means list all the files that are starting with Emp.



      Now, we have completed defining the file Adapter Service. Click on Finish.



    Create an XML Schema.




     Create a BPEL Process as shown below.


     Provide Name and select template as Synchronous BPEL Process, Browse for Input and Output XSD’s.


      Inside the Bpel Drag and drop Invoke activity as shown.


     Create Input and Output Variables for the Invoke activity by clicking on the “+” symbol.


     Take an Assign Activity In between Receive and Invoke and map the elements as shown.
       To trigger the service map the Input variable to invoke input variable.


     Drag and drop assign activity and place in between invoke and reply and map the elements as shown.
      Map  Size(Invoke Output variable) to no of files( Output variable).


    Now Deploy this Project. Give input as ListFiles to trigger this service.



     Below figure is the flow trace of the Listfiles project.
       Read folder has 2 files starting with Emp, we can see those 2 files with file directory, filename,



HappyLearning


                                                                                                                                   By DeepthiReddy

Working with Synchronuous Read in Oracle SOA 11g



Synchronous Read File Operation reads the current contents of a file.

     Create a new SOA Project


      Provide Project Name as SynchRead


     As Synchronous read file is an Outbound Operation, right click on external references select
     Insert->File Adapter as shown below.


    Then you will see welcome page of file adapter configuration wizard.


      Provide Service Name as SynchRead.


    Select Operation Type as Synchronous Read File and click on Next.


     Browse for the Directory in which your file is there to read, also browse for the archive folder and click         on Next.


    Provide the file name that you want to read and click on Next.


     Now, you need to build XML using Native formant Builder.


    Select as shown below.


     Browse for the file that you want to read as shown below.


      As the file contains only one record select 1st option  and click on next.


     Provide Target Namespace  and enter a name for element that will represent record as shown below.


    Specify Delimiters and click on next.


    Provide proper names for the elements as shown below.


    Test the schema as shown.


     We have completed generating native format.


    We have finished defining the File Adapter Service. Click On Finish.


    Create an XML Schema as shown below and click on OK.


     Provide filename, Target namespace, prefix as shown below.




    Create BPEL Process .


     Provide Name, and select template as synchronous BPEL Process,Browse for the Input and Output        XSD’s




     Inside the Bpel Drag and drop Invoke activity as shown below.


    Create Input and output variables by clicking on “+” symbol


     Drag & drop Assign activity as shown.


       For triggering this service just map the input variable to invoke input variable as shown.

<!--[endif]-->

     Drag and drop transform activity to map the elements from Invoke output variable to output variable.


      Map the elements as shown below.


    Now Deploy this Project,Give Input as SynchRead to trigger the service.


      Now we can see that the file has been read and the file will be deleted successfully from File Read folder        and will be placed in File Archive Folder.




HappyLearning

                     
                                                                                                          By DeepthiReddy




Mediater In Oracle SOA 11g


HI Guys

Lets Understand Mediater in Bpel in this post.
Oracle Mediator is a service component of the Oracle SOA Suite that provides mediation capabilities such as selective routing, transformation, and validation capabilities, along with various message exchange patterns, such as synchronous, asynchronous, and event publishing or subscriptions.
Oracle Mediator provides a lightweight framework to mediate between various components within a composite application. Oracle Mediator converts data to facilitate communication between different interfaces exposed by different components that are wired to build a SOA composite application. For example, Oracle Mediator can accept data contained in a text file from an application or service, transform it into a format appropriate for updating a database that serves as a customer repository, and then route and deliver the data to that database.
Oracle Mediator facilitates integration between events and services, where service invocations and events can be mixed and matched. You can use an Oracle Mediator service component to consume a business event or receive a service invocation. An Oracle Mediator service component can evaluate routing rules, perform transformations, validate, and either invoke another service or raise another business event. You can use an Oracle Mediator service component to handle returned responses, callbacks, faults, and timeouts.

Oracle Mediator provides the following features:
1.Content-Based and Header-Based Routing
2.Synchronous and Asynchronous Interactions
3.Sequential and Parallel Routing of Messages
4.Transformations
5.Validations
6.Java-callouts

Requirement : This is the Main BPEL process that wires up the earlier two BPEL process that we developed , Mediator helps is transforming and routing the input request to BPEL process 1 ( that writes into DB Adapter based on Approval) or BPEL process 2 ( that writes to File adapter based on Business rule)

Based on check in variable in Input variable mediator routes the message to desired BPEL Process

below is the xsd I used: StudentDetails.xsd

<?xml version="1.0" encoding="windows-1252" ?>
<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="StudentDetails">
  <xsd:complexType>
  <xsd:sequence>
   <xsd:element name="StudentNo" type="xsd:int"/>
  <xsd:element name="StdentName" type="xsd:string"/>
  <xsd:element name="Sub1" type="xsd:integer"/>
  <xsd:element name="Sub2" type="xsd:integer"/>
  <xsd:element name="Sub3" type="xsd:integer"/>
  <xsd:element name="GrandTotal" type="xsd:integer"/>
  </xsd:sequence>
  </xsd:complexType>
    </xsd:element>
</xsd:schema>
 

Create a New SOA Project with Mediator,

 

Create  a mediater with Interface definition from wsdl



Add a web service Adapter , tie up both the BPEL wsdls by giving its corresponding webservice URLs



Here are Mediation Rules

If Max Salary is greater than 300 it calls BPEL Process 1 WebService, if max salary less than 300 then BPEL Process 2 Web service is called



edit Assign Values in Mediator.plan as below



Final Mediator.plan looks as below



Test cases

 Test the Service with two inputs 
case:  GrandTotal < 300 ex: 280
case:  GrandTotal>=300 ex:410


HappyLearning


                                                                                                                By Deepthi Reddy



FTP JCA-Properties in SOA 11g

Hi Guys


Lets Discuss about JCA Properties Corresponding to FTP Adapter


Case Scenario:   MOVE the File on FTP server to Another Directory on FTP server


The I/O use cases for the Oracle FTP Adapter are very similar to those for Oracle File Adapter. However, there are a few nuances that need attention.
In this use case you move a file within the same directory, which is similar to a rename operation on the same server. Most FTP servers support the RNFR/RNTO FTP commands that let you rename a file on the FTP server.

You can model only a part of this procedure by using the wizard because the corresponding Adapter Configuration Wizard is not available. You must complete the remaining procedure by manually configuring the generated JCA file.
You must perform the following steps to move a file from a remote directory to another remote directory on the same FTP server:
  1. Create an empty BPEL process.
  2. Drag and drop FTP Adapter from the Component Palette to the External References swim lane. The Adapter Configuration Wizard Welcome page is displayed.
  3. Click Next. The Service Name page is displayed.
  4. Enter a service name in the Service Name field.
  5. Click Next. The Adapter Interface page is displayed.
  6. Click Next. The FTP Server Connection page is displayed.
  7. Enter the JNDI name for the FTP server, and click Next. The Operation page is displayed.
  8. Select Synchronous Get File, enter GET in the Operation Name field, and then click Next. The File Directories page is displayed.
 Change the  JCA file as below

<adapter-config name="FTPSyncRead" adapter="FTP Adapter" wsdlLocation="FTPSyncRead.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
 
  <connection-factory location="eis/ftp/localdomain"/>
  <endpoint-interaction portType="SynchRead_ptt" operation="SynchRead">
    <interaction-spec className="oracle.tip.adapter.ftp.outbound.FTPIoInteractionSpec">
     <property name="SourcePhysicalDirectory" value="Dirl"/>
      <property name="SourceFileName" value="File1"/>
      <property name="TargetPhysicalDirectory" value="Dir2"/>
      <property name="TargetFileName" value="File2"/>
      <property name="Type" value="MOVE"/>
    </interaction-spec>
  </endpoint-interaction>
</adapter-config>


ADD headers 


<bpelx:inputProperty name="jca.file.SourceDirectory"
variable="Dir1"/>
<bpelx:inputProperty name="jca.file.SourceFileName"
variable="File1"/>
<bpelx:inputProperty name="jca.file.TargetDirectory"
variable="Dir2"/>
<bpelx:inputProperty name="jca.file.TargetFileName"
variable="File2"/>


Assign the Values to the Headers:

 <assign name="Assign_FILESyncReada">
      <copy>
        <from expression="'/FTPSyncRead'"/>
        <to variable="Dir1"/>
      </copy>
      <copy>
        <from expression="'/FTPSyncWrite'"/>
        <to variable="Dir2"/>
      </copy>
      <copy>
        <from expression="'Input.txt'"/>
        <to variable="File1"/>
      </copy>
      <copy>
        <from expression="'Move.txt'"/>
        <to variable="File2"/>
      </copy>
    </assign>

Lastly change the composite.xml as below

 <reference name="FTPSyncRead" ui:wsdlLocation="FTPSyncRead.wsdl">
    <interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/ftp/SOATECHBLOG/FTPSyncREad/FTPSyncRead#wsdl.interface(SynchRead_ptt)"/>
    <binding.jca config="FTPSyncRead_ftp.jca"/>
    <property name="UseNativeRenameOperation" type="xs:string" many="false" override="may">true</property>

  </reference>

Note:

Use the SourceIsRemote and TargetIsRemote properties to specify whether the source and target file are on the local or remote file system, as shown 

 <property name="SourceIsRemote" value="false"/> 
 <property name="TargetIsRemote" value="false"/>
 

HappyLearning

                                                                                                            By DeepthiReddy