Table of Contents

Creating Schema and Tables

Users should have either MSSQL or MySQL. Express version of MSSQL is also supported.

Overview of the Tables

Tables needed by Stocktrader application

  1. Account
  2. AccountProfile
  3. Quote
  4. Holding
  5. Orders

Tables needed by PHP Stocktrader Configuration service

In addition to the tables given above, some other tables are needed by PHP Configuration service.

  1. DBConfig - shows the database configurations
  2. Service - shows the end point addresses of the business services and order processor services. Valid values for "ServiceName" are PHP_BS, PHP_OPS, PHP_OPSSEC, JAVA_BS, JAVA_OPS, JAVA_OPSSEC, RUBY_OPS, RUBY_OPSSEC, DOTNET_BS, DOTNET_OPS and DOTNET_OPSSEC
  3. ClientToBS - Shows what clients are connected to what business services. Possible "Client" values are DOTNET_CLIENT, PHP_CLIENT, RUBY_CLIENT. Possible "BS" values are PHP_BS, JAVA_BS and DOTNET_BS. Table can contain multiple rows.
  4. BSToOPS - Shows what business services are connected to what order processor services. Possible "BS" values are PHP_BS, JAVA_BS and DOTNET_BS. Possible "OPS" values are PHP_OPS, PHP_OPSSEC, JAVA_OPS, JAVA_OPSSEC, RUBY_OPS, RUBY_OPSSEC, DOTNET_OPS and DOTNET_OPSSEC. "OPS" flavours are non-secure services and "OPSSEC" flavours are secure services. Table can contain multiple rows.

Steps for MSSQL

Enable TCP/IP Protocol 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. If you are using SQLExpress, enable TCP/IP for SQLEXPRESS.)


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.

Tables Needed by StockTrader applications.

Follow the instructions given here to create the tables.

Tables Needed by PHP StockTrader Configuration services

These tables should already be in your database if you have successfully setup the .NET StockTrader

These table scripts can be obtained from here. Run "Table Creation.sql" and "InsertScript.sql".

Steps for MySQL

Scripts can be obtained from here.

  1. Create a new schema and user by running the command given below. (You can change the username, password or schema name in DBCreate.sql and then run the command).
    mysql -u root -p < ./DBCreate.sql
    
    You have to enter root password when it is asked.
  2. Create tables by running the command given below. ("trade" is the user name of the newly created user. "StockTraderDB" is the name of the newly created schema. If you changed either username or schema name, then change the command accordingly)
    mysql -u trade StockTraderDB -p < ./TableCreate.sql
    
    You have to enter the password of user "trade". Default is "yyy".
  3. Populate the tables with data by running the command below. (If you changed either username or schema name, then change the command accordingly)
    mysql -u trade StockTraderDB -p < ./InsertScript.sql
    
    You have to enter the password of user "trade"

Installing Stonehenge PHP Stocktrader

Installation Guide for Windows Users

If you have any other PHP, Apache httpd or WSF/PHP installed in your system, please remove them from your path before starting the installation process.

You can follow one of the options given below.

Option1
  1. SOAWAMP
    SOAWAMP-0.7 distribution includes pre-configured Apache HTTP Server, PHP and WSF/PHP. After installing, edit <WAMP Installed Directory>\udrive\usr\local\apache2\conf\httpd.conf and change the listen port to 8080. Also, edit <WAMP Installed Directory>\udrive\usr\local\php\php.ini disable warnings from php (error_reporting = E_ERROR & ~E_NOTICE). Run <WAMP Installed Directory>\Server_Start.bat to start the server. You can stop the server by running <WAMP Installed Directory>\Stop.bat. (When starting the server, the page will be redirected to http://localhost/apanel/ and then fail. It can be ignored, since the error is due to port change. Changing the endpoint to http://localhost:8080/apanel/ will give a valid page).
  2. Stonehenge PHP Stocktrader
Option2
  1. WampServer
    WampServer(WampServer 2.0h) distribution includes pre-configured Apache HTTP Server and PHP. After installing, add <WAMP Installed Directory>\bin\apache\apache2.2.11\bin to PATH environment variable. Open <WAMP Installed Directory>\bin\apache\apache2.2.11\conf\httpd.conf and change the listen port to 8080 (listen 8080). Open <WAMP Installed Directory>\bin\apache\apache2.2.11\bin\php.ini and edit as follows
  2. PHP MSSQL Driver - Only needed if you are using MSSQL
    You can download it from here and copy to <WAMP Installed Directory>\bin\apache\Apache2.2.11\bin.
  3. WSF/PHP
    Install WSF/PHP. You can download it from here. Please follow Installing WSO2 WSF/PHP Binary in WampServer to install. After installing, restart the computer to get the PATH variable refected in WampServer.
  4. Stonehenge PHP Stocktrader
Option3
  1. Apache HTTP Server
    You can download apache web server (apache_2.2.11-win32-x86-openssl-0.9.8i.msi) from here. After installing, edit httpd.conf and change the "Listen" port to 8080. Add <httpd installed directory>\bin directory to the PATH environment variable.
  2. PHP
    Download and install PHP(PHP 5.2.9-1 installer). Add the directory where PHP was installed to the PATH environment variable. After installing PHP, open php.ini file and edit as follows
  3. PHP MSSQL Driver - Only needed if you are using MSSQL
    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. Please follow the "Installing WSO2 WSF/PHP Binary" section of README.INSTALL_WIN32 file to install.
  5. Stonehenge PHP Stocktrader

Installation Guide for Linux Users

  1. Apache HTTP Server
    Use your package management system to install Apache web server. Also, you can download Apache web server (httpd-2.2.11.tar.gz) from here. After installing, edit httpd.conf and change the "Listen" port to 8080.
  2. MySQL
    Install MySQL from the package management system that comes with your distribution. After installing, open up the MySQL configuration file (my.cnf) and make sure there's no skip-networking option. If there is, comment it out, otherwise Stonehenge PHP StockTrader will not be able to connect to MySQL via HTTP.
  3. PHP
    Install PHP from the package management system your distribution is using. Make sure you install Apache PHP module. Also install PHP MySQL extension.
    After installing, open up the Apache configuration file (httpd.conf) to make sure that PHP extension is enabled. Then, open up the PHP configuration file (php.ini) and make sure php_mysql extension is enabled.
  4. WSF/PHP
    Install WSF/PHP. You can download it from here. Please follow the "Building and Installing WSO2 WSF/PHP from Source on Linux" section of README.INSTALL file to install.
  5. Stonehenge PHP Stocktrader

Default Endpoint Addresses

These are the default endpoint addresses. User should be able to access following end points. Please click them and make sure you could be able to access it. If any of them are inaccessible, then check the installation steps again.

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

Configuration

The default configuration for the PHP StockTrader Website is to use the PHP_BS for communicating with the Business Service, and PHP_OPS when processing orders. For more information on configuration options see the Stonehenge Interoperability Walk-through.

Installing Stonehenge WSAS Stocktrader

Prerequisite

  1. JDK 1.5
    You can download JDK 1.5 from here. Set JAVA_HOME environment variable to the path where JDK is installed.
  2. JCE
    Download and install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.
  3. WSO2 WSAS
    You can download WSO2 WSAS from here. The version should be 3.0. Please follow INSTALL.txt of WSAS Package to install.
  4. MSSQL JDBC Driver - Only needed if you are using MSSQL
    You can download MSSQL JDBC driver (jtds-1.2.2.jar) from here and copy to <WSAS Installed Directory>\lib\extensions.
  5. MySQL JDBC Driver - Only needed if you are using MySQL
    You can download MySQL JDBC driver (mysql-connector-java-5.1.7-bin.jar) from here and copy to <WSAS Installed Directory>\lib\extensions. (You might have to download full "Source and Binaries" pack from the download link, unzip it and copy only mysql-connector-java-5.1.7-bin.jar)
  6. Maven
    If you are building Stonehenge WSAS Stocktrader from source files, then you need mavan installed. The version should be 2.0.8 or more. Please follow README.txt of maven package to install.

    WSAS Stocktrader uses configuration service shipped with PHP Stocktrader. So, you have to install PHP Stocktrader as well, to use WSAS Stocktrader.

Installing Trunk Version

Default Endpoint Addresses

These are the default endpoint addresses. Please make sure you can access the endpoints by appending ?wsdl to the endpoints. (i.e. to check business service, check whether http://localhost:9763/services/TradeServiceWsas?wsdl is accessible and gives WSDL of the business service)

  1. Business Service
    http://localhost:9763/services/TradeServiceWsas
  2. Non-secure Order Processor
    http://localhost:9763/services/OrderProcessor
  3. Secure Order Processor
    http://localhost:9763/services/OrderProcessorMsec

Configuration

The default configuration for the WSAS Business Service is JAVA_OPS when processing orders. For more information on configuration options see the Stonehenge Interoperability Walk-through.