Its was a great moment, before the year end 2012 we were able to release an Alpha version of long awaited WSO2 Stratos 2.0, and It was a great experience to be in part of the Stratos 2.0 team.
Stratos 2.0 is the next version of Stratos 1.x, and provides features including,
Git / Git-hub integration support
Pluggable cartridges ( PHP, MySQL and WSO2 carbon cartridges)
Autoscaling into EC2 or Openstack
Custom Domain Mapping support
I will explain further on Stratos 2.0 architecture and functionality in future posts.
You may have experienced an additional spaces or unexpected indentation when you paste some text into Vim from another application. To avoid that you need to set paste toggle option in Vim
Follow the steps below
$ vim ~/.vimrc
Put the following in your vimrc (change to whatever key you want):
set pastetoggle=
save and exit.
To paste from another application:
* Start insert mode.
* Press F2 (toggles the 'paste' option on)
* Use your terminal to paste text from the clipboard.
* Press F2 (toggles the 'paste' option off).
WSO2 Mashup Server can be used to create and host JavaScript based mashups, acting as a hub for integrating your enterprise with rich information available on the web. Each mashup hosted in here is exposed as a new web service, and can be consumed by other mashups or web service clients.
In this post I'm going to show you how to get started with a JavaScript service, and consume that service inside another JavaScript (A client) embedded in an HTML page.
The scenario I'm going to cover is, developing a JavaScript based service for getting stock updates, which retrieve the stock information by invoking another external web service , and writing a JavaScript client inside an HTML, which invokes the JavaScript service.
Writing the service
1. Download WSO2 Mashup Server binaries and extract into a convenient location (Hereafter referred to as MS_HOME )
2. The JavaScript service should be written as a standard JavaScript file, as mentioned below
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6. After successfully starting up the server, note that a folder is created in <MS_HOME>/repository/deployment/server/jsservices/admin with the name stockQuote.resources.
Create a new folder with the name "www" if such a folder is not there already. Service client related code should be place in that folder.
1. The sample code of StockQuote service client is listed below, note that it is embedded in an HTML file (which is the UI of your service) and in the top you can see a reference to the generated stub is included. Save this as index.html file into the "www" folder created above. <MS_HOME>/repository/deployment/server/jsservices/admin/stockQuote.resources/www
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2. Access the UI of the as follows to test the functionality http://localhost:9763/services/admin/stockQuote/
In the text box, input a Stock symbol (eg: GOOG, IBM, VRTU .. etc) and check the results
Troubleshooting
In some situations, the generated JavaScript stubs are having some issues (which are already identified and will be fixed in the next release)
In such a scenario, as a hack you can do the following.
1. Access the stub (http://localhost:9763/services/admin/stockQuote?stub) and save the stub file in <MS_HOME>/repository/deployment/server/jsservices/admin/stockQuote.resources/www location as "stockQuoteStub.js"
2. The "bf2xml" function of the stub is the culprit here, so as a fix replace the relevant code related to bf2xml function with the code below
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3. In index.html file modify the line which has the reference to the stub, so remove the line
and add the following line instead
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters