95-843 Service Oriented Architecture Carnegie Mellon University Assigned: Friday, November 11, 2011 Homework 3 Due: Monday November 21, 11:59:00 PM In this graded project you will build a composite application using Oracle's SOA Suite 11g. This composite will be built from three components. The first component is a file adapter. It will be configured to read a file when that file is placed into the NewData directory. The adapter will poll for the file every 10 seconds. It will then delete the file and make a copy of it to an archive directory. It will also generate an XML equivalent file and construct an XSD that contains the grammar for the XML. This XML file will be available to the other components in the SOA Suite. The second component in the composite is also a file adapter. It will write data to a log file. The third component is a mediator component (think lightweight ESB) that will read data from the first component, transform it using XSLT, and write the data to the second component. Each member of each team needs to be able to execute these steps. However, we will be grading based on the team's solution and will not break it down and grade individuals. 0) The steps below have been adapted and modified from the book "Oracle SOA Suite 11g Handbook" and these steps are also found on this web site (see chapter 7): http://technology.amis.nl/blog/13380/soa-suite-11g-handbook-chapter-complements 1) Create a directory called C:\Testing with subdirectories C:\Testing\NewData and C:\Testing\NewSampleData and C:\Testing\Log and C:\Testing\Archive. 2) Build a text file named C:\Testing\NewSampleData\CoolArrivedData.txt with the following data: 1,Jones,Andy,ENG100,PSY050,MAT220 2,Hein,Peter,MAT010,CHM230,CSC401 3,Miller,Kyle,MAT010,CHM230,HST080 4,Williams,Ann,MAT010,ENG100,PSY050 5,Kim,Jenny,ENG100,CHM230,HST080 6,Carter,Herb,PSY050,CHM230,CSC401 7,Popov,Dimitri,PSY050,PHY100,ENG100 8,Smith,Kellie,PSY050,HST080,ECN110 3) Build a text file named C:\Testing\NewSampleData\CoolLoggedData.txt with the following data: 2011-11-11,Michael,McCarthy 4) Run JDeveloper and create a new SOA Application with an empty composite. This application will be called CoolCopyTransformAndLogApplication and the composite will be called CoolCopyTransformAndLogComposite. 5) Drag and drop a file adapter to the Exposed Services Lane. 6) Name the service provided by the adapter CoolReadFileAndGenerateXMLService. 7) Select Define from operation and schema (specified later) 8) Select Read File as the operation type and give it the name CoolReadArrivedDataOperation. 9) Select Logical Name for directory names. 10) The logical directory name is COOLINPUTDIR. 11) We do not need to process the files recursively. 12) We do want to archive processed files. Give this directory the logical name COOLARCHIVE. 13) We do want to delete files after successful retrieval. 14) Use wild cards and include files with the name pattern *.txt. 15) There are multiple messages and we will publish message in batches of 1. 16) Set the polling frequency to 10 seconds. In real life, this field would be much larger. 17) The minimum age is 0. 18) We are not using a trigger file. We must describe the format of the XML document that is to be generated. 19) Click the gear icon to the right of the URL text box. 20) The file type is delimited. 21) We will browse to the first data file above to use as our sample. 22) The file contains multiple record instances all of a single type. 23) Our namespace is http://coolexample.com/coolarriveddata. 24) The element name containing multiple records is coolRoot. 25) Our record name is coolRecord. 26) Give each field a name. Use the names: RecordID,Last,First,Course1,Course2,Course3. 27) An XSD will be generated. Give it the name CoolArrivedData.xsd. 28) Use the testing page to see if we are generating the correct XML from the sample data file. 29) We are finished and should return to the Adapter Configuration wizard. 30) The URL field (to the left of the gear) should now point to our schema xsd. 31) Finish the wizard. The new service is displayed. 32) We need to associate the logical names with physical names. Do this by placing a complete file path as the value of the property element that is nested within the binding.jca element in composite.xml. C:\Testing\NewData : C:\Testing\Archive 33) Drag a new file adapter to the references lane of the the composite editor. We will use this adapter to generate a log file from the XML arriving from the first adapter. 34) The name of this new service is LogNames. 35) We will define from operation and schema later. 36) We are using this adapter to write files. 37) The operation name is WriteCoolLogFile. 38) Use the logical name COOLLOGDIR. 39) Next to file naming conventions enter CoolLog.txt. 40) Select append to existing file. 41) To the right of the URL input box, select the gear symbol. 42) We want to create a new file of the delimited type. 43) The file name of the sample is C:\Testing\NewSampleData\CoolLoggedData.txt (This should be present from an earlier step) 44) We want to generate multiple records all of the same type. 45) The target namespace is http://coolexample.com/coollog. 46) The name containing multiple records is CoolInputLog. 47) The name containing each record is CoolInput. 48) The first field is named Date, the second is named FirstName and the last is named LastName. 49) The XSD file name is LogInput.xsd. 50) Finish and return to the adapter configuration wizard. To the left of the gear should be the URL of the XSD. 51) We need to associate the logical names with physical names. Do this by placing a complete file path as the value of the property element that is nested within the binding.jca element in composite.xml. C:\Testing\Log 52) We need a mediator to take the XML from the input adapter and write it to the output adapter. 53) Drag a mediator and place it in the Components Lane in the Composite Editor. 54) Name the mediator CoolMoverFromInputToOutput and define the interface later. 55) Click and drag to create a wire from the input adapter to the mediator. 56) Click and drag to create a wire from the mediator to the output adapter. 57) Double click the mediator and click the mapping icon to the right of "Transform Using". 58) This is a New XSLT mapper. Name it InputToLog.xsl 59) In the mapping editor on the left is the input XSD. On the right is the output XSD. 60) Drag the current-date function to the middle lane. Connect that to the Date element in the output tree. 61) Drag the name data from the input to the output as appropriate. 62) Deploy the project by right clicking the project and selecting deploy. 63) How will you Test it? Place the CoolArrivedData.txt file into the NewData directory and see if it soon disappears. The Archive and Log directories should be populated. 64) Inform your TA that your group has completed the project and that it is deployed. He will log on to your virtual machine and test it with his own data file. In your email to the TA, be sure to include the names of your group members and your group number.