Stonehenge StockTrader, PHP 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. Apache HTTP Server

    You can download apache web server from here.
  2. PHP

    Download and install PHP. After installing PHP, open php.ini file and edit as follows
    1. enable php_mssql extension (extension=php_mssql.dll)
    2. disable warnings from php (error_reporting = E_ERROR & ~E_NOTICE)
    3. specify an error_log file name. In case there are any errors in the execution of PHP Stock Trader, error messages will be written to this file. (error_log = "C:\src\wsf\php\wso2-wsf-php-bin-1.3.1-win32\wsf_c\logs\php_error.log")
    4. Increase the max_execution_time to 100.
  3. PHP MSSQL Driver

    Default MSSQL Driver coming with some PHP installation is too old to work correctly. You can find this information by checking the version of ntwdblib.dll (This file can be found in root directory of where you installed php. E.g. “C:\Program Files\PHP”). It should be 2000.80.194.0 or more. If the version is less than 2000.80.194.0, then you have to download it from here and copy to PHP directory.
  4. WSF/PHP

    Install WSF/PHP. You can download it from here. Version should be 1.3.2 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 PHP Stock Trader

Download PHP Stock Trader from here and unzip it.
  1. Installing Trader Client
    Copy the contents of trader_client folder to <Apache Installed Directory>\htdocs\trader_client
  2. Installing Business Service
    Copy the contents of business_service folder to <Apache Installed Directory>\htdocs\business_service. 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.  To change the end point of config service, you have to edit configuration_service_config.xml. 
  3. Installing Order Processor
    Copy the contents of order_processor folder to <Apache Installed Directory>\htdocs\order_processor. 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.
  4. Installing Configuration Service
    Copy the contents of config_service folder to <Apache Installed Directory>\htdocs\config_service. 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. Run "Table Creation.sql" in the database to create new tables needed by configuration service.  Run "InsertScript.sql" to populate end points of the services. If you want to change the ip or port of service end points, you can modify it in "Service" table of "StockTraderDB" database. 

Endpoint Addresses

These are the default endpoint addresses
  1. Trader Client
    http://localhost:8080/trader_client/index.php
  2. Business Service
    http://localhost:8080/business_service/business_svc.php
  3. Non-secure Order Processor
    http://localhost:8080/order_processor/order_processor_svc.php
  4. Secure Order Processor
    http://localhost:8080/order_processor/order_processor_svc_msec.php
  5. Configuration Service
    http://localhost:8080/config_service/config_svc.php