Web Services Brian A LaMacchia Microsoft Five Questions What is a Web Service Why are Web Services interesting Why should I care about them What e commerce business models do Web Services enable What security and privacy issues need to be addressed for Web Services to be successful What the heck is Microsoft s NET Platform all about and how does NET relate to Web Services What is a Web Service Software Design Principles Abstraction Componentization In your own programs Reusable software components Current web usage User oriented browsing User oriented data publication Software Design Principles Abstraction Procedural abstraction public static int Square int x return x x int y Square 3 y is 9 We abstract reuse useful functions all the time in programs Abstraction hides implementation details Abstraction Hides Details public static float GetQuote String symbol implementation goes here details are hidden from caller public static void Main String args float msftPrice GetQuote MSFT Console WriteLine MSFT 0 F2 msftPrice C test exe MSFT 61 40 Only need to worry about inputs to outputs from a method or function Componentization We share code among programs by creating software components Ex Software libraries that you link against when you compile programs or that you reference dynamically usr pkg bin perl use Finance YahooQuote symbols msft intc dell hwp cpth q getquote symbols foreach a q print a 0 a 2 a 5 n Software Components Reusable components are valuable You can sell components Save time Coding Debugging Save testing effort Share knowledge Markets exist for software libraries You can given them away to sell something else Ex Device drivers Components are local Local code execution Execute on your machine Code source or object must live on your local machine Maybe do just in time download install Not so great if the data is remote Ex Stock analysis component Wants as much historical data as possible Is everyone going to cache the last 100 years of the NYSE on their hard disks Ex complex searches against the NYT archives Want code to run on the server Saved by the Web Web Usage Today Web usage today is browser oriented Users browse for information Vast databases are accessed through HTML gateways user friendly displays Example Yahoo s stock ticker Yahoo has tons of stock price history sitting behind http quote yahoo com That info is easily available to anyone who browses to the right page But look at how the info is presented Yahoo s Stock Ticker Screen scraping Data is formatted for easy use by people not programs Programs need to mimic users to Scrape the screen Parse make use of the data Call server side functions plot a chart compute something perform a search etc Download the HTML and then pattern match against it Inefficient and fragile Data type semantics are lost We need a better mechanism for making Web published data and component software functions available to programs What is a Web Service Software components application logic accessible via standard Web protocols Available to any client that speaks the necessary Web protocols XML SOAP Programming the Web Better remote procedure calls over the Web Web sites with no user interface Platform independent components Enable highly distributed systems Finding talking to Web Services Clients need answers to three separate questions What services are available How do I communicate with this particular service Let s talk Give me some data Three Standards UDDI Universal Description Discovery and Integration WSDL Web Service Description Language Document describing the message exchange contract SOAP Simple Object Access Protocol Yellow pages directory for services XML based protocol for messaging All based on XML the foundation Web Services In Practice Find a Service http www uddi org UDDI Link to WSDL document Web Service Consumer How do we talk WSDL http yourservice com WSDL XML with service descriptions Web Service Let me talk to you SOAP http yourservice com svc1 XML SOAP BODY Design Time or Dynamic Runtime Why are Web Services interesting For Developers Access to a Web wide library of software components Smart development tools can Help you locate useful Web Services Download service descriptions WSDL Automatically generate code from the WSDL to talk to the service using SOAP over HTTP On the server side automatically generate WSDL for a service from its source code WSDL for a Quote Service xml version 1 0 encoding utf 8 definitions xmlns soap http schemas xmlsoap org wsdl soap xmlns tns http www themindelectric com wsdl net xmethods services stockquote StockQuote xmlns s http www w3 org 2001 XMLSchema xmlns http http schemas xmlsoap org wsdl http xmlns tm http microsoft com wsdl mime textMatching xmlns mime http schemas xmlsoap org wsdl mime xmlns soapenc http schemas xmlsoap org soap encoding targetNamespace http www themindelectric com wsdl net xmethods services stockquote StockQuote name net xmethods services stockquote StockQuote xmlns http schemas xmlsoap org wsdl types message name getQuoteResponse1 part name Result type s float message message name getQuoteRequest1 part name symbol type s string message portType name net xmethods services stockquote StockQuotePortType operation name getQuote parameterOrder symbol input message tns getQuoteRequest1 message tns getQuoteRequest1 output message tns getQuoteResponse1 message tns getQuoteResponse1 operation portType binding name net xmethods services stockquote StockQuoteBinding type tns net xmethods services stockquote StockQuotePortType soap binding transport http schemas xmlsoap org soap http style rpc operation name getQuote soap operation soapAction urn xmethods delayed quotes getQuote input soap body use encoded namespace urn xmethods delayed quotes encodingStyle http schemas xmlsoap org soap encoding input output soap body use encoded namespace urn xmethods delayed quotes encodingStyle http schemas xmlsoap org soap encoding output operation binding service name net xmethods services stockquote StockQuoteService documentation net xmethods services stockquote StockQuote web service documentation port name net xmethods services stockquote StockQuotePort binding tns net xmethods services stockquote StockQuoteBinding soap address location http 64 39 29 211 9090 soap port service definitions Auto gen Code from WSDL This source code was auto generated by wsdl Version 1 0 3430 0 using System Diagnostics using System Xml Serialization using System using System Web Services
View Full Document