ASP.NET AJAX with Web Services
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

ASP.NET AJAX with Web Services

on

  • 1,383 views

 

Statistics

Views

Total Views
1,383
Views on SlideShare
1,382
Embed Views
1

Actions

Likes
0
Downloads
4
Comments
0

1 Embed 1

http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

ASP.NET AJAX with Web Services Presentation Transcript

  • 1. ASP.NET AJAX with Web Services Noah Subrin Atlanta MS Pros Cutting Edge VB .Net Study Group November 5, 2007
  • 2. Speaker Biography
    • Technical Lead – SRA International
    • MCSD and MCSD .Net
    • Participates in developer community events in the Southeast
    • Published several articles on www.sswug.org
  • 3. What we will discuss tonight
    • Brief ASP .Net AJAX 1.0 overview
    • AJAX Programming models
    • Focus on Remote Services
    • Web Services
    • Page Methods
    • Built in API’s
  • 4. Traditional Web Apps
    • Web was originally designed for static pages
    • Today’s web is much more interactive.
    • Client issues a request, the server returns HTML markup, and the entire page is refreshed
    • Everything is done on the web server
  • 5. AJAX-Enabled Applications
    • AJAX apps use a client side framework to make out of band calls to the server
    • AJAX server side framework returns data to the customer that is primarily in the form of JSON but may be XML or other formats such as RSS, CSV
    • Reduces bandwidth required and UI’s are able to be redrawn using partial rendering
    • More code is executed on the browser
  • 6. So What is ASP .Net 2.0 AJAX?
    • Server side ASP 2.0 AJAX extensions that are installed in global assembly cache (GAC)
    • Client side JavaScript libraries that can be used stand alone
    • Visual Studio 2005 or Visual Web Developer are not necessary to use server side components (but they provide templates)
  • 7. AJAX Programming Models
    • Partial Page Rendering
    • Script Services
    • Local web services
    • Page Methods
    • How to call external web services
    • Authentication services
    • Profile Web services
  • 8. Characteristics of AJAX services
    • REST services (Representational State Transfer)
    • Each URL represents the state of an object retrieved using an HTTP verb (GET, POST, PUT)
    • Tied to the platform and domain where they are hosted
    • Not SOA in truest sense
    • Who uses REST ? Amazon, Yahoo and many others
  • 9. REST Web Services
    • Predates the WS* specs
    • Typically easier to read than SOAP
    • New operation can be exposed without updating web reference
    • REST relies on HTTP verbs and URL’s to express the operation
    • Not a standard (like SOAP) or a protocol (like HTTP)
    • Each operation has a distinct URL
  • 10. SOAP Web Services
    • SOAP services are an XML based protocol SOAP services need an envelope, message, header, and body
    • WSDL to describes the web service API
    • XML Schema describes the call
    • Uses a single URL
    • Can support WS* specs
  • 11. AJAX Web Services Demos
    • Expose the web services to clients
    • Calling web services from the client
    • Fire and Forget
    • Returns a Value
    • Takes Parameters
    • Handles an Error
    • Lengthy Operation
    • User Context and method Names
    • Complex Types
  • 12. Why only Local Services?
    • Security implications of cross site calls
    • SOAP is harder to manage from client side JavaScript
    • No XML parser is needed
    • Support for JSON serialization which uses name-value pairs
  • 13. What about WCF Services?
    • In ASP .Net AJAX 1.0 we are currently unable to call WCF services
    • Support for WCF services calls from AJAX in Orcas will presumably be enhanced
  • 14. Page Methods
    • Provide ability for client script to call a static method in an ASP .Net page as if it were a web service.
    • Scoped within a page -cannot be called from a different page other than where they are defined
    • Decorated with WebMethod attribute
  • 15. More on Page Methods
    • All types will be JSON serialized
    • Not enabled by default, to enable, we set the ScriptManager property EnablePageMethods=true
    • The page acts as a web service
  • 16. PageMethods Demo
    • Writing to Session object from a PageMethod
  • 17. PageMethods vs AJAX Web Services
    • From PageMethods we can access Session state, ASP .Net Cache, and User objects
    • For PageMethods we don’t have to create an .asmx web service
    • Local Web services are callable from every page
    • Web services are callable by SOAP based clients
    • For both - don’t include any critical business logic (replay attacks)
  • 18. Calling external web services
    • Not included in ASP .Net AJAX Extensions 1.0
    • New file type .asbx, which is an xml file
    • It contains info on how to connect to a remote web service
    • This is a Futures technology but it is possible to build manually using WebMethod or PageMethod
    • Client calls its own server – local server calls a remote server
  • 19. Application Services
    • Forms Authentication
    • Profile Information
  • 20. Forms Authentication
    • We can use the MS AJAX library authentication service to verify credentials stored as part of the ASP .Net membership application service
    • Server configuration is in web.config
    • Server issues a ticket
    • Client browser needs cookies enabled
  • 21. Forms Authentication Demo
    • Restrict Directory Access
    • JavaScript Functions
    • Web.config settings
    • Membership provider
  • 22. Profiles Web Services
    • The profile service enables you to use the ASP.NET profile application service from client side JavaScript
    • Must enable the Profile Service in the web.config
    • By default, no profile properties are available. For each profile property that you want to make available in a client application, add the property name to the readAccessProperties attribute of the < profileService > element.
  • 23. Profile Services Demo
    • Adding custom properties to a .Net 2.0 Provider
  • 24. Summary
    • We can create and expose local web services to client side JavaScript
    • We can use local web services or PageMethods
    • We used JSON serialization
    • We leveraged callback functions to update the pages
    • We can call ASP.Net 2.0 Authentication and Profile services from client side JavaScript
  • 25. Additional Resources
    • www.asp.net/ajax
    • SOAP Specification http:www.w3.org/tr/soap )
    • REST Specification
    • http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
    • Introducing Microsoft ASP .Net AJAX by Dino Esposito
    • Professional ASP .Net 2.0 AJAX by Matt Gibbs and Dan Wahlin
  • 26. Contact Info
    • Email address:
    • support @ federalsystems.net
    • Blog: blogs.federalsystems.net