In this post we are going to read an xml file using read operation of file adapter and then we will write this to a file by using another file adapter component.
1) Create a new SOA application using JDeveloper and give name as “SampleFileReadWrite” and click next and name your project as “SampleFileReadWritePro” make sure SOA is select click next and then finish with Empty Composite Template
2) Now we are going to create two XSD files for our File Adapter. This will show how to create an XSD file in SOA. It is schema file that defines input and output of different services. In you project right click on xsd folder. Give name as “InputData” and click OK.
3) Click on the source view of your newly created file, Copy the below XML and past(override) into your InputData file.
<?xml version=”1.0″ encoding=”UTF-8″ ?>
<xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:nxsd=”http://xmlns.oracle.com/pcbpel/nxsd”
xmlns:tns=”http://TargetNamespace.com/readFile”
targetNamespace=”http://TargetNamespace.com/readFile”
elementFormDefault=”qualified”
attributeFormDefault=”unqualified”>
<xsd:element name=”ReadFile”>
<xsd:complexType>
<xsd:sequence>
<xsd:element name=”ReadFiles” minOccurs=”1″ maxOccurs=”unbounded”>
<xsd:complexType>
<xsd:sequence>
<xsd:element name=”FirstName” type=”xsd:string”/>
<xsd:element name=”LastName” type=”xsd:string”/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
4) Similarly create a another XSD file named as “OutputData” and copy below data in it.
<?xml version=”1.0″ encoding=”UTF-8″ ?>
<xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:nxsd=”http://xmlns.oracle.com/pcbpel/nxsd”
xmlns:tns=”http://TargetNamespace.com/readFile”
targetNamespace=”http://TargetNamespace.com/readFile”
elementFormDefault=”qualified”
attributeFormDefault=”unqualified”>
<xsd:element name=”Writefile”>
<xsd:complexType>
<xsd:sequence>
<xsd:element name=”WriteFiles” minOccurs=”1″ maxOccurs=”unbounded”>
<xsd:complexType>
<xsd:sequence>
<xsd:element name=”FName” type=”xsd:string”/>
<xsd:element name=”LName” type=”xsd:string”/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
5) Now click on composite.xml file to open it if its not open already. Drag and Drop a Mediator in Components pallet of composite and give name as “RouteRequest” and select “Define Interface later ” as template if not selected already.
Click to move on part 2 of this post