Stonehenge StockTrader, Ruby Installation Guide


WSO2 StockTrader is an online stock trading sample application with functionality equivalent to the Microsoft .NET Stock Trader sample benchmark application and IBM WebSphere's Trade 6.1 sample application. WSO2 StockTrader is powered by WSO2 WSF/PHP , WSO2 WSF/Ruby, WSO2 WSF/Perl, WSO2 WSF/Python, WSO2 WSF/Spring and WSO2 WSAS and implements the application in PHP, Ruby, Perl, Python, Spring and Java. It serves to illustrate interoperability between .NET, PHP, Ruby, Perl, Python, Spring and Java in deploying high-performance, scalable service oriented applications.

Prerequisite

  1. Ruby

    Download and install Ruby. 
  2. Ruby MSSQL Driver

    Get the latest source distribution of Ruby-DBI and copy the file "lib/dbd/ADO.rb" to "<your ruby installed location>/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb". 
  3. MySQL server

    Download and install MySQL server. It is needed to create rails applications. 
  4. WSO2 WSF/Ruby

    Install WSO2 WSF/Ruby. You can download it from here. Version should be 1.1.0 or more. Please follow the README file to install.
  5. .NET Stock Trader 2.0

    You can download it from here.
  1. Enable TCP/IP Protocols of MSSQL server

    Open “SQL Server Configuration Manager” from Start->Programs->Microsoft SQL Server 2005->Configuration Tools-> SQL Server Configuration Manager. Enable TCP/IP and disable Named Pipes from protocols of your MSSQL server. (Note that, in following picture, MSSQLSERVER is the name of the SQL server. In your case, the name might be different)


    Open TCP/IP Properties by double clicking “TCP/IP”. Set “Listen All” to “Yes” in Protocol tab.



    From IP Address tab, disable “TCP Dynamic Ports” by leaving it blank and give a valid “TCP Port” so that MSSQL server will listen in that port. (We have used port 1433 in order processor services, so it is better to use that port)


    Similarly, enable TCP/IP from SQL Native Client Configuration and disable Named Pipes. Also, check whether the port is set correctly. (Port should be 1433)




    After finishing above settings, restart MSSQL Server.

Installing Ruby Stock Trader

Download Ruby Stock Trader from here and unzip it.
  1. Installing Trader Client
    Create a rails application by running "rails trader_client_app". Copy the contents of "trader_client\app" folder to <trader_client_app rails Application Directory>\app. Copy the contents of "trader_client\public" folder to <trader_client_app rails Application Directory>\public.  If you are using rails 2.0.0 or above you may need to configure the database information in your rails application. Edit <trader_client_app rails Application Directory>\config\database.yml and give username, password or your MySQL server. Also you have to create a database in your MySQL server and give the database name in the configuration. You can find a guide on how to configure the database here. After setting them, you can start trader_client_app rails application on port 3000 (or some other port) by running "ruby script\server -p 3000" from <trader_client_app rails Application Directory>. Note: You have to use different rails applications for trader_client and order_processor. They have to run on different ports.
  2. Installing Order Processor
    Create a rails application by running "rails order_processor_app". Copy the contents of "order_processor" folder to <order_processor_app rails Application Directory>\app\controllers. After copying, edit database_config.xml and give IP and Port of the MSSQL server. You don't need to change user name, password or database settings. If you are using rails 2.0.0 or above you may need to configure the database information in your rails application. Edit <order_processor_app rails Application Directory>\config\database.yml and give username, password or your MySQL server. Also you have to create a database in your MySQL server and give the database name in the configuration. You can find a guide on how to configure the database here. After setting them, you can start order_processor_app rails application on port 3005 (or some other port) by running "ruby script\server -p 3005" from <order_processor_app rails Application Directory>. Note: You have to use different rails applications for trader_client and order_processor. They have to run on different ports.

Endpoint Addresses

These are the default endpoint addresses
  1. Trader Client
    http://localhost:3000/trade
  2. Non-secure Order Processor
    http://localhost:3005/OrderService
  3. Secure Order Processor
    http://localhost:3005/OrderServiceMsec