Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building and Using Web Services with ASP.NET Rob Howard Program Manager.NET Framework Team Microsoft Corp.

Similar presentations


Presentation on theme: "Building and Using Web Services with ASP.NET Rob Howard Program Manager.NET Framework Team Microsoft Corp."— Presentation transcript:

1 Building and Using Web Services with ASP.NET Rob Howard Program Manager.NET Framework Team Microsoft Corp.

2 Agenda Overview Overview Standards Based Standards Based Building Web Services Building Web Services Using Web Services Using Web Services Beyond the Basics Beyond the Basics Web Service Security Web Service Security Summary Summary

3 What is a Web Service? Browser is the most common tool for accessing information on the Internet Browser is the most common tool for accessing information on the Internet  Web browser is not enough…  Devices, etc. A web service is programmable application logic accessible via standard Web protocols A web service is programmable application logic accessible via standard Web protocols  Programmable…  Available to a variety of clients (platform independent)  Standard protocols…  Network level interoperability

4 Common Questions/Issues How do you publish the location of a web service? How do you publish the location of a web service? How do you describe a web service? How do you describe a web service?  What protocols does it support?  What data types does it use? Challenges Challenges  Programming model  Understanding of protocols, serialization, discovery, etc. Solutions today still have complexities: Solutions today still have complexities:  Microsoft SOAP Toolkit  IBM (SOAP Toolkit)

5 Standards Based SOAP (Simple Object Access Protocol) SOAP (Simple Object Access Protocol)  Explicit serialization (HTTP + XML description) protocol used in service exchanges WSDL (Web Service Description Language) WSDL (Web Service Description Language)  XML document describing the location and interfaces a particular service supports – the client's contract DISCO (Discovery) DISCO (Discovery)  XML document describing (URI) of service UDDI (Universal Description Discovery and Integration) UDDI (Universal Description Discovery and Integration)  Yellow pages directory for services

6 Discovery Let me talk to you (SOAP) Web Services (In Practice) Design-Time or Dynamic Runtime http://yourservice.com HTML or XML with link to WSDL How do we talk? (WSDL) http://yourservice.com/?WSDL XML with service descriptions http://yourservice.com/svc1 XML/SOAP BODY WebService WebServiceConsumer UDDI Find a Service http://www.uddi.org Link to DISCO or WSDL document

7 ASP.NET Technology for building web applications Technology for building web applications  ASP defined web development (PHP, JSP, etc.)  ASP.NET will set the new standard Core themes for ASP.NET Core themes for ASP.NET  Making it easier to build web apps  Making it easier to deploy web apps  Making it easier to operate web apps  Providing great performance and scalability

8 ASP.NET Web Services Goal: Make building web services easy Goal: Make building web services easy  Compiled on first request or pre-compiled  First class feature of ASP.NET  File extension is.asmx Write application logic Write application logic  Use features of.NET to enable SOAP  We’re doing the interop work…

9 ASP.NET Web Services Part of the ASP.NET application model Part of the ASP.NET application model  Web Service is represented by an URL  Access to common objects: Request, Session, Application, etc. The web service emits no UI The web service emits no UI  SOAP is for applications  However…. Supports multiple protocols Supports multiple protocols  Including SOAP  Extensible…

10 Demo: Simple and Complex Demo 1 – Writing a simple service Demo 1 – Writing a simple service  Add Demo 2 – Comparing VB and C# Demo 2 – Comparing VB and C#  Fibonacci Demo 3 – Writing a more complex service Demo 3 – Writing a more complex service  Data Access

11 3 Mandatory additions, 1 optional addition  Names the class and/or language used Imports System.Web.Services Imports System.Web.Services  Required namespace [WebMethod] or [WebMethod] or  Method is ‘web callable’ WebService base class WebService base class  Access ASP.NET intrinsic objects.asmx Deconstructed

12 Http-Get / Http-Post Http-Get / Http-Post  Html forms name/value SOAP (Simple Object Access Protocol) SOAP (Simple Object Access Protocol)  Simple, lightweight XML protocol for exchanging structured and typed information on the Web  W3C note (May 8, 2000)  Supported by Microsoft, IBM, and others  Data is sent via POST (or M-POST)  Extensible XML document (Envelope, Encoding Rules, RPC) Protocols

13 Using Web Services Proxy characteristics Proxy characteristics  Classes are strongly typed  Supports both async and sync Visual Studio.NET Visual Studio.NET  Add Web Reference to a Project WebServiceUtil.exe WebServiceUtil.exe  Classes can be created in any.NET language  WSDL file from a given.NET class  Defined server.NET class from an WSDL

14 Demo: Building Proxies Demo 1 – Building a Proxy with VS.NET Demo 1 – Building a Proxy with VS.NET  Data Access Demo 2 – Building a Proxy with Command line tool Demo 2 – Building a Proxy with Command line tool  Data Access

15 Beyond the Basics Soap Headers Soap Headers  Great way to send out of band data  Not part of the body  Similar to HTTP Headers XML Attributes XML Attributes  Shape the XML to the format you need  XmlAttribute, XmlElement, XmlArray  SoapAttribute, SoapElement, SoapArray Screen Scrape Screen Scrape  Turn any HTML site into a web service*

16 Demo: Beyond the Basics Demo 1 – Working with SOAP Headers Demo 1 – Working with SOAP Headers  Simple Demo 2 – Shaping an XML document Demo 2 – Shaping an XML document  Order Details Demo 3 – Screen Scraping Demo 3 – Screen Scraping  Barnes and Noble

17 Built-in Security Features Data hiding (encryption): Data hiding (encryption):  Supports HTTPS  Use.NET Crypto classes ‘roll your own’  Beta 1 does not support certificates Authentication / Authorization Authentication / Authorization  Supports Forms authentication  Supports Windows authentication  Supports ‘roll your own’

18 Design Suggestions Know and understand the supported data types Know and understand the supported data types Don't send unnecessary data (such as an image) when you can send a URL Don't send unnecessary data (such as an image) when you can send a URL Eliminate latency in the server first Eliminate latency in the server first Use caching where possible Use caching where possible Build the service to be asynchronous if the potential exists to block other work Build the service to be asynchronous if the potential exists to block other work

19 Design Suggestions Handle client errors when the server is unavailable Handle client errors when the server is unavailable Cache data from the service where possible, rather than requesting the same data 100 times Cache data from the service where possible, rather than requesting the same data 100 times Be efficient about the number of requests for dynamic data - collapse multiple web service methods into one Be efficient about the number of requests for dynamic data - collapse multiple web service methods into one Read the SOAP, DISCO, and WSDL specs Read the SOAP, DISCO, and WSDL specs

20 Summary Building and using web services is.NET Building and using web services is.NET Microsoft provides the leading platform for building web applications and services Microsoft provides the leading platform for building web applications and services  Great support for XML, HTTP, HTML  Full extensibility enables developers to support the latest protocols ASP.NET technology makes writing web services simple ASP.NET technology makes writing web services simple  Share application logic  Use existing skills and knowledge  Consistent development framework  Tool support is incredible!

21 Resources Microsoft ASP.NET Web Site Microsoft ASP.NET Web Site  http://www.asp.net Books Books  Wrox - “Preview of ASP+“  Others definitely on the way Additional Sites Additional Sites  http://msdn.microsoft.com/  http://www.4guysfromrolla.com/  http://www.asptoday.com  http://www.aspfree.com  http://www.aspng.com/

22 Web Services Adopters


Download ppt "Building and Using Web Services with ASP.NET Rob Howard Program Manager.NET Framework Team Microsoft Corp."

Similar presentations


Ads by Google