In our first episode of the Enterprise 2.0 Workbench, we walk through using ADF to consume and display XML from Twitter. From the ADF application we then create a portlet entry that allows our application to be produced as WSRP2 and consumed by WebCenter. This approach will work for any XML, even without an XSD file – as we will learn how to generate our own XSD from any XML.
Development Steps
- Open Twitter and find an account that you would like to follow
- View the RSS feed for that account and save it to a location on your local disk
- Open JDeveloper
- Create a new application called “Twitter Fusion” using the Application Template “Fusion Web Application (ADF)”
- Navigate to “Application” -> “Project Properties” -> “Java EE Application” and update “Java EE Web Application Name” and “Java EE Web Context Root” to “twitter”
- Add “WebCenter Portlet Creation Service” to the view project
- Create folder in “Web Content” called “xsd”, this will house the XSD file that let’s JDeveloper understand the content coming from Twitter
- Within the XSD folder create a new file “XML Schema from XML Document”, name this file twitter.xsd, browse to the XML document that you saved from Twitter’s RSS feed
- Within the “Web Content” folder create a new JSF page, name it twitter.jspx
- Run the JSF page and note the URL (http://x.x.x.x:7101/twitter/faces/xsd/twitter.xsd)
- Using the path copy the URL to the XSD file
- In the Model project create a new URL Data Control using the RSS feed as the URL and the URL to the XSD that was just created
- Drill into the newly created Data Control DC_URL -> loadData() -> Return -> rss -> channel -> item and drag and drop the item node into the JSF page
- On the ADF page select Table -> ADF Read-only Table from the options list
- Enable “Row Selection” and “Sorting”, remove description, guid and source
- Navigate to the “af:table” node in Structure pane in JDeveloper and select “af:table”
- In the Property Inspector pane under Apperance -> ColumnStretching select Last
- On the JSF page click and drag the Title column to the far right of the page
- Right click the JSF page and select Run to review the page
- In JDeveloper right click twitter.jspx and select “Create Portlet Entry”. Enter TwitterFusion in the first 4 fields and enter a description/
- Right click twitter.jspx and select Run
- In your browser adjust the URL to expose the WSDL for the WSRP entry for the new portlet – use the WSRP2 entry (http://x.x.x.x:7101/twitter/portlets/wsrp2?WSDL)
- Open the Enterprise Manager instance for WebCenter
- Navigate to the Register Producer section of Enterprise Manager and enter the WSRP2 URL from the WSDL displayed in your browser previously. Call the new entry Twitter Fusion
- Open your WebCenter instance, navigate to a page and open composer. Select Portlets -> Twitter Fusioon -> and TwitterFusion to add the Twitter portlet to your page.
Ksandhya
Hi John, is there a way to get only the “Tweets” part and display it on the jsff page? Thanks.