Example 2  Example 4

Chapter 5: Using Adaptive Server Enterprise Web Services

Example 3

This example invokes a Web method to display stock information with a join between the method proxy table and another table. To use this Web service, you must create a table to hold symbols representing stocks:

1> create table stocksymbol(symbol varchar(100))
2> go

Insert data into the stocksymbol table:

1> insert stocksymbol values("SY")
2> insert stocksymbol values("PSFT")
3> insert stocksymbol values("ORCL")
4> insert stocksymbol values("MSFT")
5> insert stocksymbol values("SUNW")
6> go

Use the add option of sp_webservices to map Web methods to proxy tables:

1>sp_webservices "add" ,
"http://webservices.try.sybase.com/web/services/StockQuotes?wsdl" , ws
2>go

Two Web methods are mapped to proxy tables. One of these Web methods is named getQuote.

Invoke the Web method by executing a join on the symbol column of the stocksymbol table and the _symbol column of the getQuote proxy table:

1> SELECT symbol,getQuoteReturn
FROM getQuote , stocksymbol
WHERE getQuote._symbol = stocksymbol.symbol
2> go

symbol        getQuoteReturn
------        --------------
SY            22.469999 
PSFT          21.040001 
ORCL          13.730000 
MSFT          27.070000 
SUNW          5.700000 
(5 rows affected)




Copyright © 2004. Sybase Inc. All rights reserved. Example 4

View this book as PDF