Your SlideShare is downloading. ×
0
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
ASP.NET AJAX with Web Services
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

ASP.NET AJAX with Web Services

1,292

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,292
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

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

×