WSO2 is an open source application development software company focused on providing service-oriented architecture solutions for professional developers...
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
In Web development, a mashup is a Web page or application that uses and combines data, presentation or functionality from two or more sources to create new services...
The Apache Software Foundation is a non-profit corporation to support Apache software projects, including the Apache HTTP Server. The ASF was formed from the Apache Group and incorporated in Delaware, U.S., in June 1999.The Apache Software Foundation is a decentralized community of developers...
Axis2 and other open source projects, and provides JavaScript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
authors the ability to consume, compose and emit web service
Web service
A Web service is a method of communication between two electronic devices over the web.The W3C defines a "Web service" as "a software system designed to support interoperable machine-to-machine interaction over a network". It has an interface described in a machine-processable format...
s, feeds, scraped web pages, email, and instant messages. The source code is freely available under the open source Apache License
Apache License
The Apache License is a copyfree free software license authored by the Apache Software Foundation . The Apache License requires preservation of the copyright notice and disclaimer....
. It provides a runtime platform for developing and deploying mashups. It can be downloaded and deployed locally or within an organization.
A Web service is a method of communication between two electronic devices over the web.The W3C defines a "Web service" as "a software system designed to support interoperable machine-to-machine interaction over a network". It has an interface described in a machine-processable format...
s centric in that each mashup exposes a new web service, which can be consumed by other mashups, web service clients, or Ajax style web pages. The securability of web service
Web service
A Web service is a method of communication between two electronic devices over the web.The W3C defines a "Web service" as "a software system designed to support interoperable machine-to-machine interaction over a network". It has an interface described in a machine-processable format...
In software engineering, a Service-Oriented Architecture is a set of principles and methodologies for designing and developing software in the form of interoperable services. These services are well-defined business functionalities that are built as software components that can be reused for...
In Web development, a mashup is a Web page or application that uses and combines data, presentation or functionality from two or more sources to create new services...
s.
To date, it is the only open source composition platform available for mashup developers.
JavaScript as a mashup composition language
Mashups are composed using server side JavaScript in the WSO2 Mashup Server. A set of language extensions along with E4X provides domain specific features such as;
The name Atom applies to a pair of related standards. The Atom Syndication Format is an XML language used for web feeds, while the Atom Publishing Protocol is a simple HTTP-based protocol for creating and updating web resources.Web feeds allow software programs to check for updates published on a...
based publishing,
Periodic task scheduling,
E-mailing and
IM
A Hello World
function hello {
return "Hello World";
}
Calling a SOAP web service
function invokeGetVersionService{
var version = new WSRequest;
var options = new Array;
options.useSOAP = 1.2;
options.useWSA = 1.0;
options.action = "http://services.mashup.wso2.org/version/ServiceInterface/getVersionRequest";
// Creating an RSS 2.0 feed and writing it to file.
function createRssFeed{
// Creating the Feed
var feed = new Feed;
feed.feedType = "rss_2.0";
feed.title = "This is a test Feed";
feed.description = "This feed demonstrates the use of Feed host object to create an RSS 2.0 feed.";
feed.link = "http://mooshup.com/rss20.xml";
// Creating Entries in the Feed
var entry = new Entry;
entry.title = "This is a test entry.";
entry.description = "This is a sample entry demonstrating the use of the Entry host object.";
feed.insertEntry(entry);
var entry2 = new Entry;
entry2.title = "This is another test entry.";
entry2.description = "This is a sample entry demonstrating the use of the Entry host object.";
// Adding a Media Module to the entry
var mediaModule = new
MediaModule("http://www.earthshots.org/photos/387.jpg");
mediaModule.copyright = "2007 Tad Bowman";
mediaModule.type = "image/jpeg";
mediaModule.thumbnail = "http://www.earthshots.org/photos/387.thumb.jpg";
entry2.addMediaModule(mediaModule);
feed.insertEntry(entry2);
// Writing the newly created Feed to a File
var result = feed.writeTo("test-created-rss-feed.xml");
return result;
}
Web scraping
function webScrape{
var config =
;
var scraper = new Scraper(config);
result = scraper.response;
return result;
}
The syntax is identical to another open source web scraping tool called web harvest.
Working with APP
function persistAuthenticatedAppFeed{
// Creating an instance of APPClient
var client = new APPClient;
// Creating an instance of AtomFeed
var feed = new AtomFeed;
// Setting login credentials for the client
client.credentials={username:"you@email.com",password:"xxx",service:"blogger",authtype:"google"};
// Retrieving and online feed
feed = client.getFeed("http://blog.mooshup.com/feeds/posts/default");
// Getting an array of individual entries from the feed
var entries = new Array;
entries = feed.getEntries;
// Writing the retrieved feed to a file
feed.writeTo("my-file-name.xml");
}
Periodic Task Scheduling
// Scheduling a function to be executed every 2 seconds
var uuid = system.setInterval('myJavaScriptFunction("parameterValue")', 2000);
// Stopping the above scheduled task
system.clearInterval(uuid);
Sending an e-mail
function sendEmail{
var email = new Email("host", "port", "username", "password");
var file = new File("temp.txt");
email.from = "test@wso2.com";
email.to = "test@wso2.com"; // alternatively message.to can be an array of strings. Same goes for cc and bcc
email.cc = "test@wso2.com";
email.bcc = "test@wso2.com";
email.subject = "WSO2 Mashup server 1.0 Released";
email.addAttachement(file, "temp.txt"); // Optionally can add attachments, it has a variable number of arguments. each argument can be a File hostObject or a string representing a file.
// In this case we are sending two attachments (this demonstrates sending attachments using either a File Host Object or a path to the file).
email.text = "WSO2 Mashup server 1.0 was Released on 28th January 2008";
email.send;
}
In Web development, a mashup is a Web page or application that uses and combines data, presentation or functionality from two or more sources to create new services...
Yahoo! Pipes is a web application from Yahoo! that provides a graphical user interface for building data mashups that aggregate web feeds, web pages, and other services, creating Web-based apps from various sources, and publishing those apps...
Yahoo! query language is an SQL-like query language created by Yahoo! as part of their Developer Network. YQL is designed to retrieve and manipulate data from APIs through a single Web interface, thus allowing mashups that enable developers to create their own applications.Initially launched in...