Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Table of Contents

Creating Schema and Tables
Anchor
database
database

Tip
titleNote

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

Overview of the Tables
Anchor
Tables
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
Anchor
MSSQL
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

Note
titleNote

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
Anchor
MySQL
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).
    Code Block
    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)
    Code Block
    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)
    Code Block
    mysql -u trade StockTraderDB -p < ./InsertScript.sql
    
    You have to enter the password of user "trade"

Installing Stonehenge PHP Stocktrader
Anchor
php
php

Installation Guide for Windows Users
Anchor
Windows
Windows

Note
titleNote

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
    • Trunk version of Stonehenge PHP Stocktrader can be checked out from here.
    • If you are using source release version, PHP Stocktrader is in <Stocktrader Source Release Pack>/stocktrader/php/
    • If you are using trunk version or source release version, run build.bat, which will create php_stocktrader folder.
    • If you are using binary release version, php_stocktrader folder is inside <Stocktrader Binary Release Pack>/
    • Copy php_stocktrader folder to <WAMP Installed Directory>\udrive\www\ .
    • After copying, edit <WAMP Installed Directory>\udrive\www\php_stocktrader\resources\conf\database_config.xml and give IP and Port of the Database server. Also indicate whether you are using "mssql" or "mysql". You can change user name, password or database settings if needed.
    • To change the end point of config service, you have to edit <WAMP Installed Directory>\udrive\www\php_stocktrader\resources\conf\configuration_service_config.xml.
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
    • If you are using mssql, enable php_mssql extension (extension=php_mssql.dll)
    • If you are using mysql, enable php_mysql extension (extension=php_mysql.dll)
    • disable warnings from php (error_reporting = E_ERROR & ~E_NOTICE)
    • 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 = <full path with file name>)
    • Increase the max_execution_time to 100. (max_execution_time = 100)
    • Start the WAMP Server, browse to http://localhost:8080/?phpinfo=1 and make sure iconv, libxml, and mssql/mysql sections are available.
  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
    • Trunk version of Stonehenge PHP Stocktrader can be checked out from here.
    • If you are using source release version, PHP Stocktrader is in <Stocktrader Source Release Pack>/stocktrader/php/
    • If you are using trunk version or source release version, run build.bat, which will create php_stocktrader folder.
    • If you are using binary release version, php_stocktrader folder is inside <Stocktrader Binary Release Pack>/
    • Copy php_stocktrader folder to <WAMP Installed Directory>\www\ .
    • After copying, edit <WAMP Installed Directory>\www\php_stocktrader\resources\conf\database_config.xml and give IP and Port of the Database server. Also indicate whether you are using "mssql" or "mysql". You can change user name, password or database settings if needed.
    • To change the end point of config service, you have to edit <WAMP Installed Directory>\www\php_stocktrader\resources\conf\configuration_service_config.xml.
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
    • If you are using mssql, enable php_mssql extension (extension=php_mssql.dll)
    • If you are using mysql, enable php_mysql extension (extension=php_mysql.dll)
    • disable warnings from php (error_reporting = E_ERROR & ~E_NOTICE)
    • 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 = <full path with file name>)
    • Increase the max_execution_time to 100. (max_execution_time = 100)
  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
    • Trunk version of Stonehenge PHP Stocktrader can be checked out from here.
    • If you are using source release version, PHP Stocktrader is in <Stocktrader Source Release Pack>/stocktrader/php/
    • If you are using trunk version or source release version, run build.bat, which will create php_stocktrader folder.
    • If you are using binary release version, php_stocktrader folder is inside <Stocktrader Binary Release Pack>/
    • Copy php_stocktrader folder to <Apache Installed Directory>\htdocs\ .
    • After copying, edit <Apache Installed Directory>\htdocs\php_stocktrader\resources\conf\database_config.xml and give IP and Port of the Database server. Also indicate whether you are using "mssql" or "mysql". You can change user name, password or database settings if needed.
    • To change the end point of config service, you have to edit <Apache Installed Directory>\htdocs\php_stocktrader\resources\conf\configuration_service_config.xml.
      Warning
      titleWarning

      If you are using some other versions of Apache Http Server, PHP and WSF/PHP, make sure all of them were built using same openssl libraries. Binary distribution of WSF/PHP was built using openssl 0.9.8i, hence cannot be used with Apache Http Server or PHP built with different version of openssl. In that case, you might have to get source distribution of WSF/PHP and build it using the correct openssl libraries.

Installation Guide for Linux Users
Anchor
Linux
Linux

  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
    • Trunk version of Stonehenge PHP Stocktrader can be checked out from here.
    • If you are using source release version, PHP Stocktrader is in <Stocktrader Source Release Pack>/stocktrader/php/
    • If you are using trunk version or source release version, run build.sh, which will create php_stocktrader folder.
    • If you are using binary release version, php_stocktrader folder is inside <Stocktrader Binary Release Pack>/
    • Copy php_stocktrader folder to <Apache document root> (usually /var/www/html/).
    • After copying, edit <Apache document root>\php_stocktrader\resources\conf\database_config.xml and give IP and Port of the Database server. Also indicate that you are using "mysql". You can change user name, password or database settings if needed.
    • To change the end point of config service, you have to edit <Apache document root>\php_stocktrader\resources\conf\configuration_service_config.xml.

Default Endpoint Addresses
Anchor
EndpointsPHP
EndpointsPHP

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
Anchor
ConfigPHP
ConfigPHP

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
Anchor
wsas
wsas

Prerequisite
Anchor
PrerequisiteWSAS
PrerequisiteWSAS

  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.
    Note
    titleNote

    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
Anchor
InstallingWSAS
InstallingWSAS

  • Trunk version of Stonehenge WSAS Stocktrader can be checked out from here.
  • If you are using source release version, WSAS Stocktrader is in <Stocktrader Source Release Pack>/stocktrader/wsas/
  • If you are using trunk version or source release version, run the command "mvn clean install", which will create wsas_stocktrader folder inside target folder (target\wsas_stocktrader).
  • If you are using binary release version, wsas_stocktrader folder is inside <Stocktrader Binary Release Pack>/
  • Copy content of <wsas_stocktrader>\ * to <WSAS Installed Directory>\.
  • After copying, edit <WSAS Installed Directory>\webapps\ROOT\WEB-INF\classes\db.properties and give IP and Port of the Database server. Also indicate whether you are using "mssql" or "mysql". You can change user name, password or database settings if needed.
  • To change the end point of config service, you have to edit <WSAS Installed Directory>\webapps\ROOT\WEB-INF\classes\config-svc.properties.
  • If you want to enable logging from Order Processor service and Business service, edit log4j.properties in <WSAS Installed Directory>\webapps\ROOT\WEB-INF\classes\ and include following line:
    Code Block
    log4j.logger.org.apache.stonehenge.stocktrader=DEBUG
    

Default Endpoint Addresses
Anchor
EndpointsWSAS
EndpointsWSAS

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
Anchor
ConfigWSAS
ConfigWSAS

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.