WSO2 Mashup Server

{{short description|Mashup platform}}

{{more citations needed|date=April 2021}}

{{Infobox software

| name = WSO2 Mashup Server

| logo = Mashup logo.gif

| screenshot =

| caption =

| author =

| developer = WSO2 and Community

| released = {{start date and age|2008|01|28}}

| discontinued = yes

| latest release version = 2.3.2

| latest release date = {{start date and age|2011|11|01}}{{cite mailing list |url=https://mail.wso2.org/mailarchive/announce/2011-November/000010.html |title=WSO2 Mashup Server 2.3.2 Released ! |date=2011-11-01 |df=mdy |access-date=2022-04-18 |mailing-list=WSO2 Announcements |last=Siriwardena |first=Ranga |author-link=}}

| programming language = Java

| operating system = Cross-platform

| language = English

| genre = Application server

| license = Apache License 2.0

| website = {{Official URL}}

}}

WSO2 Mashup Server, an open-source mashup platform that used to host JavaScript-based mashups, is now deprecated and no longer in use. It was based on Apache Axis2 and other open-source projects, and allowed JavaScript to consume, compose and emit web services, feeds, scraped web pages, email, and instant messages. The source code was freely available under the open-source Apache License. It provided a runtime platform for developing and deploying mashups and could be downloaded and deployed locally or within an organization.

WSO2 Mashup Server was web-services-centric in that each mashup exposed a new web service, which could be consumed by other mashups, web service clients, or Ajax style web pages. The securability of web services made them an attractive technology within organizations deploying a service-oriented architecture (SOA) and for business mashups.

On December 8, 2012, WSO2 Mashup Server was retired since its remaining functionality, JavaScript web service hosting, was folded into WSO2 Application Server.{{cite web |last=Marsh |first=Jonathan |date=2012-12-08 |df=mdy |url=https://wso2.com/blogs/thesource/2012/12/wso2-mashup-serverwhere-to-now/ |title=WSO2 Mashup Server–where to now? |department=The Source |website=wso2.com |url-status=dead |archive-url=https://web.archive.org/web/20121216192548/http://wso2.com/blogs/thesource/2012/12/wso2-mashup-serverwhere-to-now/ |archive-date=2012-12-16}} WSO2 Application Server eventually became a set of extensions to Apache Tomcat{{cite web |url=https://github.com/wso2/product-as/blob/master/README.md |title=Welcome to WSO2 Application Server |department=wso2/product-as |work=product-as/README.md at master |via=GitHub |access-date=2022-04-18}} and JavaScript hosting was provided by Jaggery based upon Rhino.{{cite web |url=https://github.com/wso2/jaggery/blob/master/README.md |title={jaggery.js} - The delicious Javascript framework |department=wso2/jaggery |work=jaggery/README.md at master |via=GitHub |access-date=2022-04-18}}{{cite web |title=Jaggery |url=https://jaggeryjs.org/ |archive-url=https://web.archive.org/web/20210516160349/https://jaggeryjs.org/ |archive-date=2021-05-16}}

JavaScript as a mashup composition language

Mashups are composed using server side JavaScript in WSO2 Mashup Server. A set of language extensions along with E4X provides domain specific features such as;

  • Calling other SOAP/REST web services
  • RSS/Atom feed reading and writing
  • Web scraping
  • APP based publishing
  • Periodic task scheduling
  • E-mailing
  • Instant messages

=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";

var payload = null;

var result;

try {

version.open(options, "http://localhost:7762/services/system/version", false);

version.send(payload);

result = version.responseE4X;

} catch (e) {

system.log(e.toString(), "error");

return e.toString();

}

return result;

}

=Working with feeds=

// 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();

}

See also

References

{{Reflist}}