Project Phase III
Goal:
To equip you with more SQL querying skills and more importantly, familiarize you
with Web Service technology.
Through this project, you will learn:
-
How to create Web Services with .Net.
-
How to use other people's Web Services.
Milestones:
-
Friday, Feb 27: Create your Web Services with at least an empty body so the TAs
can add your Web Services to the test harness. And email Brian and Jessica your
group name and your group password (for transaction log).
-
Wednesday, Mar 10: Phase III due.
Details:
Web Services:
Before we go into the details of the Web Services you will implement, let's
first discuss their purposes. Your companies will compete with each other to
generate the most revenue. At the beginning of the day, the TAs will first clear
and then randomly populate your
inventory with products of certain quantities and prices. TAs will play the
customers' role by trying to buy certain products from your company. Your
company will try to sell the customers items currently stocked in your
inventory as well as items out of stock, in which case your company can order
them from other companies depending on their availability
and price. You may add 5% of the transaction as your
revenue for being the middleman. At the end of the trading day, your company
will report your total revenue to the TAs, which is
used to determine the winner group. NOTE: You will not be graded on how much
money you make. But only on the correctness of your Web Services.
First, you will create your Web Services project under iisqlsrv.cs.washington.edu/[group
name]WebService . Here are the five Web Services functions
you will be implementing. You must create them with the given function
signatures.
-
Clear your inventory
-
Function signature: void clear()
-
Functionality : if anyone calls this function, you will empty your inventory
table. And reset revenue to zero.
-
Accept inventory assignment
-
Function signature: void acceptInventory(string productName, int suggestedPrice,
int quantity)
-
Function parameters: Whenever such function is called, you can put quantity
many productName in your inventory table. suggestedPrice
is the suggested price you sell each productName at in cents,
not in dollars. You can set price to be anything, but you probably don't want
to set the price too low, or else your company loses money. And you cannot sell
it as higher than 50% of the suggestedPrice.
-
Availability and price
-
Function signature: ProductInfo productInfo(string productName)
-
Function parameters: The return value is a struct ProductInfo
for the productName, which is defined here: struct ProductInfo{
int availability,
int price
}
-
Accept product orders
-
Function signature: bool acceptOrder(string productName, int price,
int quantity, string companyName)
-
Function parameters: When the company called companyName orders quantity
many the product called productName, you can decide to accept the
order or decline the order by returning true or false relatively.
-
Report revenue
-
Function signature: int revenue()
-
Function parameters: This function should return the revenue you made at the
current time.
Example code for dynamic Web Service invocation is here
Log the Transactions:
Every time a transaction occurs, you must report that to the IRS, played by the
TA's web services. If you receive an order, you need to write to the seller
log. If you make an order, you need to write to the buyer log.
-
To write to the seller log, call this web service:
-
Function signature: void sellerLog(string sellerGroupName, string
sellerPassword, string buyerGroupName, string productName, int quantity, int
pricePerUnit)
-
Function parameters: buyerGroupName buys quantity many
productName at pricePerUnit cents per unit from sellerGroupName,
which has the password, sellerPassword.
-
To write to the buyer log, call this web service:
-
Function signature: void buyerLog(string sellerGroupName, string
buyerPassword, string buyerGroupName, string productName, int quantity, int
pricePerUnit)
-
Function parameters: buyerGroupName, which has the password, buyerPassword,
buys quantity many productName at pricePerUnit
cents per unit from sellerGroupName.
These two Web Services will be located athttp://iisqlsrv.cs.washington.edu/briancks/phase3/log.asmx
(Will be up after all of you submit your group password).