This example invokes a Web method to display stock information within an XML document.
Use the add option of sp_webservices to map Web methods to proxy tables:
1> sp_webservices "add" , "http://www.webservicex.net/stockquote.asmx?WSDL" 2> go
The Web method GetQuote is mapped to a proxy table of the same name.
Invoke the Web method by selecting the outxml column of the GetQuote proxy table:
1> select outxml from GetQuote where _inxml = '<?xml version="1.0" encoding="utf-8"?> 2> <GetQuote xmlns="http://www.webserviceX.NET/"> 3> <symbol>SY</symbol> 4> </GetQuote>' 5> go
The results for the previous select display quote information within an XML document:
outxml <?xml version="1.0" encoding="UTF-8" ?><GetQuoteResponse xmlns="http://www.webserviceX.NET/"><GetQuoteResult><StockQuotes><Stock><Symbol>SY</Symbol><Last>21.48</Last><Date>7/21/2005</Date><Time>4:01pm</Time><Change>+1.72</Change><Open>20.00</Open><High>21.60</High><Low>19.91</Low><Volume>2420100</Volume><MktCap>1.927B</MktCap><PreviousClose>19.76</PreviousClose><PercentageChange>+8.70%</PercentageChange><AnnRange>12.75 - 20.44</AnnRange><Earns>0.706</Earns><P-E>27.99</P-E><Name>SYBASE INC</Name></Stock></StockQuotes></GetQuoteResult></GetQuoteResponse> (1 row affected)