This document contains the
release information for the NGWS Trader sample. You will find the following sections below:
The client prompts the user for the name of a
Stock, and then calls the server to obtain a stock quote for the stock
specified. Trader is the server side
object and MyStock the client that uses the service.
This sample is located in
the Remoting directory of the NGWS SDK sample directories.
For Example,
the server object is located at:
C:\Program
Files\NGWSSDK\Samples\Remoting\Trader
And the
client object at:
C:\Program
Files\NGWSSDK\Samples\Remoting\MyStock
All remoting examples can be build at once by
invoking NMAKE from the Remoting directory as follows prior to running
the samples…
·
Change to
the Remoting directory and type NMAKE ALL
For Example:
C:\Program
Files\NGWSSDK\Samples\Remoting\:>NMAKE All
·
Alternatively,
go to the individual client and server directories, and build them
individually.
For Example:
C:\Program
Files\NGWSSDK\Samples\Remoting\Trader:>NMAKE All
C:\Program Files\NGWSSDK\Samples\Remoting\MyStock:>NMAKE All
Open two command windows. Start the server in one window by entering the following at the
command line
MyHost
-cfg Trader.cfg
You should get the following output
C:\NGWSSDK\Samples\Remoting\Trader>MyHost -cfg Trader.cfg
MyHost is ready to process remote messages.
Press a key and ENTER: G=GC.Collect, 0=Exit
Start
the client in another command window and enter the following
MyStockApp
-i -cfg MyStock.DirectHTTP.cfg
Sample2.bat will execute the command above and is
provided for convenience.
You should get the following output
C:\NGWSSDK\Samples\Remoting\MyStock>MyStockApp
-i -cfg MyStock.DirectHTTP.cfg
Stock Remoting Sample
**** Welcome to StockNet, 05/31/2000 16:14:21
****
Enter company code (ALL: To list all, 0:
Exit):
Any one of the following symbols is
valid input for this app.
MSFT, AOL, SUNW,
AAPL, ORCL, INTC, CPQ, DELL
Type
a stock symbol, DELL for example.
Here's the output
Enter company code (ALL: To list all, 0:
Exit): DELL
Symbol : Dell
Company : DELL
Last Trade Price: 38
Competitors:
CPQ
Compaq
SUNW
Sun Microsystems
Partners:
INTC
Intel
MSFT
Microsoft
Enter company code (ALL: To list all, 0: Exit):
The server process should echo the
following to the command line
StockQuote.GetQuotes
If this does not happen, the application is
not functioning properly. See the HelloService
example for possible reasons for this.
It
is also possible to access the server object through Internet Information
Server using HTTP. First we have to
tell IIS about our object by setting up a Virtual Root as follows:
Since the object will automatically be instantiated via the ASP framework, we don't have to start the server app when using normal HTTP.
Run the client by entering the following.
MyStockApp -i -cfg
MyStock.cfg
Sample1.bat also executes the line above and is provided for convenience. The client examples should produce exactly the same output we obtained above. The only difference between this and the previous example is that we are using a WEB server to publish the server object and the client gains access to the server object via the WEB server.
We can also run the client from a WEB browser using ASP+. Start Internet Explorer and enter the following Address
http://localhost/MyStock/SimpleQuote.aspx
The specified ASP+ page will be loaded that prompts you for a name. The output is similar to the previous examples, except that the output is displayed in the browser rather than the command line. This example assumes you have already set up the Virtual Root described above.
The MyStock directory also contains another ASP+ example. Enter the following address in Internet Explorer
http://localhost/MyStock/SmartQuote.aspx