Discover the best of the web!
Learn more about Digg by taking the tour.
How to Call Web Services using AJAX
blogs.msdn.com — At some time in your life and that time may be soon, you will need to use javascript to interact with webservices. This tutorial gives a good primer.
- 836 diggs
- digg it
- RyeBrye, on 04/08/2008, -6/+12Yeah, it can be done - kind of - but if you really need web services you should probably proxy the web service with some server-layer stuff and then send that down in a more browser-friendly XML packet to consume.
Unless, of course, you really want to try to implement WS-* stuff like WS-Security or WS-ReliableMessaging in JavaScript.
I'd recommend using GWT for this task of demarshalling stuff from the web services and marshalling it into a convenient-to-use-in-ajax format because it would be much easier to develop in the first place, and much easier to maintain in the future.- RyeBrye, on 04/08/2008, -5/+7Oh, and if you want STILL want to do this crap browser side... Here's a better article about it:
http://www.ibm.com/developerworks/webservices/libr ...- funkytaco, on 04/08/2008, -6/+1Exactly. Not this IE-centric BS.
- rogueuk, on 04/08/2008, -1/+9did you look at the article? it's all about how the .NET framework creates a proxy for you using JSON. You don't ever have to see the SOAP nastiness. The IBM article you linked too is definitely more complicated in that respect. Of course, the submitter's article will only work for .NET web services, so the IBM way is more flexible if you are using some existing SOAP web service. Overall, I don't think it's better than what this article proposes though.
- emeshuris, on 04/15/2008, -0/+0The submitters article is not for .NET only. It is using a MS javascript library, which can be used by any scripting language.
Only the tag is for .NET.
- emeshuris, on 04/15/2008, -0/+0The submitters article is not for .NET only. It is using a MS javascript library, which can be used by any scripting language.
- Wakuko, on 04/08/2008, -14/+1WHO DA ***** USES .NET???
SOAP? ARE YOU KIDDING ME???- Firehed, on 04/08/2008, -1/+5I'd really suggest giving soap a try - you'll find your local users will really appreciate you more for it.
- lateralus, on 04/08/2008, -1/+4A lot of people who have decent salaries. Check Monster.
- sega01, on 04/08/2008, -3/+3I don't think I would code in .NET for any amount of money.
- Dested, on 04/08/2008, -0/+4Haha that sounds good. I like no competition for my 126k a year job.
One mans predisposition is anothers job security.
- Dested, on 04/08/2008, -0/+4Haha that sounds good. I like no competition for my 126k a year job.
- sega01, on 04/08/2008, -3/+3I don't think I would code in .NET for any amount of money.
- kaevans, on 04/08/2008, -0/+0@RyeBrye - good point about using a server-side bridge. While there are plenty of scenarios where a JavaScript API is a great thing (http://dev.live.com/virtualearth/sdk/ and http://dev.aol.com/article/2007/silverlight_and_tr ... are great examples), there are plenty of scenarios where a JavaScript API is not appropriate - namely protocols like WS-ReliableMessaging, WS-Trust, and WS-Security. Keep watching my blog (http://blogs.msdn.com/kaevans) for an update in this series that shows what the customer's real question was and how we used a server-side bridge to implement it.
- RyeBrye, on 04/08/2008, -5/+7Oh, and if you want STILL want to do this crap browser side... Here's a better article about it:
- RyeBrye, on 04/08/2008, -2/+33On second thought... I hope that Digg developers don't read this... It might give them one more idea on how to make their comment systems' AJAX even worse...
- Narcism, on 04/08/2008, -0/+9I don't think it can get worse then having to hit "Stop Script" in Firefox in some threads...
- cresswga, on 04/08/2008, -0/+18I would digg you up but there was a problem completing my request.
- leerayIG88, on 04/08/2008, -9/+4I know aJax from...Mortal Kombat!!
- gcman94, on 04/08/2008, -12/+3I'd Tap That.........
- gcman94, on 04/08/2008, -7/+3Yeah I'm sure you would
- gcman94, on 04/08/2008, -5/+3what a loser responding to his own comments
- gcman94, on 04/08/2008, -3/+14I'm seeing how many negative diggs i can get, help me peeps.
- Anonymous3, on 04/09/2008, -0/+1It's easier to just go into an apple thread and mess with their sarcasm detectors.
- gcman94, on 04/08/2008, -3/+14I'm seeing how many negative diggs i can get, help me peeps.
- gcman94, on 04/08/2008, -5/+3what a loser responding to his own comments
- gcman94, on 04/08/2008, -7/+3Yeah I'm sure you would
- Drahkar, on 04/08/2008, -12/+1AJAX is overrated. There are better ways to implement this.
- plhearn, on 04/08/2008, -0/+7What better way to do asynchronous server calls are you talking about?
- alamandrax, on 04/08/2008, -0/+1Page redirects is what one assumes Drahkar intends to refer to.
Doesn't work when you want Rich Applications of course, but then again, if you're only going to be refreshing a small section/frame of your home page, you could try doing that. I wouldn't recommend it. Slows down browsers and a bitch to handle javascript objects, but it's not entirely impossible. - tapeworm77, on 04/09/2008, -0/+2Maybe put everything in a frame? Because everyone loves frames.
- alamandrax, on 04/08/2008, -0/+1Page redirects is what one assumes Drahkar intends to refer to.
- plhearn, on 04/08/2008, -0/+7What better way to do asynchronous server calls are you talking about?
- mark076h, on 04/08/2008, -8/+2LOL WUT
- Narcism, on 04/08/2008, -8/+7Not my type of article, but extra kudos because it's not from nasa.gov, xkcd, ron paul or ubuntu.
- SuperJimmyJimbo, on 04/08/2008, -4/+2who you gonna call?
- SirWho, on 04/08/2008, -0/+13Your mom? I'll XML her .net
- harrisbradley, on 04/08/2008, -4/+10Man, this article makes me feel retarded
- legendxx, on 04/08/2008, -0/+54Hold on.. when did digg become a technology/geek site?
/sarcasm
Used to see these kids of articles on the front page every day.. these noobs have turned it into a propaganda tool for politicians and video's that make 12 year olds ***** themselves.- br0ck, on 04/08/2008, -0/+6If you want programming content on Digg, then go to http://digg.com/all/programming/upcoming every day and Digg two or three articles that appeal to you. I don't think that It would take many people doing that for Digg to return to more of a technology emphasis. I think there's just a lot more people active in the upcoming politics section because of the current heated race, and there's a lot more people in the upcoming video section because so many people just want some of the time passing mindless diversion that's available there.
- k00k, on 04/08/2008, -7/+2AJAX: http://tinyurl.com/66suj7
- nj10ii, on 04/08/2008, -3/+1This would be so much easier implemented using Steel Wool.
- digjam, on 04/08/2008, -2/+1We did that using XOAD/SOAP...and it worked fine..though I think XOAD is not developed anymore
- Quick2822, on 04/08/2008, -2/+16I'm just impressed (and surprised) that a msdn.com domain make it to the front page of Digg.
- rksprst, on 04/08/2008, -4/+7This is purely on asp.net, it won't work for anybody who is not a "windows" developer. php, python, etc, programmers can't use this. Though there are other frameworks that simplify ajax for other languages. Such as jquery, etc...
- leightonium, on 04/08/2008, -2/+2Did you actually read the full article? Because it states that the ASP.net ajax capabilities can be called from php coldfusion etc.
- Firehed, on 04/08/2008, -2/+3Just like I can technically pull in bits of content from my company's software (a .NET CMS) in PHP. Yes, it can be done. But you'd be an idiot to waste your time actually trying to get something done that way.
(don't read that the wrong way - I vastly prefer PHP, but trying to mix anything with Microsoft tends to not work well).- emeshuris, on 04/15/2008, -0/+0Fellas! Since when did using a library written in javascript by MS mean that it can only be used by .Net.
- Firehed, on 04/08/2008, -2/+3Just like I can technically pull in bits of content from my company's software (a .NET CMS) in PHP. Yes, it can be done. But you'd be an idiot to waste your time actually trying to get something done that way.
- br0ck, on 04/08/2008, -0/+5Actually, web services are currently implemented in ASP.NET for Mono and AJAX is their next shipping goal according to their homepage at http://www.mono-project.com/ASP.NET
- kaevans, on 04/08/2008, -0/+1rksprst - I made a point to highlight that this does work for non-Microsoft developers, and there is a shared source PHP library available at http://codeplex.com/phpmsajax that simplifies using the client-side JavaScript with PHP.
- leightonium, on 04/08/2008, -2/+2Did you actually read the full article? Because it states that the ASP.net ajax capabilities can be called from php coldfusion etc.
- dadro, on 04/08/2008, -6/+12The JS that .NET generates is absolute rubbish. Look at the inline onclick and all the auto generated JS (window.onload!?). The article doesn't even show the bloat of the .net stacks rendered JS output.
Developers need to learn clean, unobtrusive code, not drag and drop, poorly structured JS. After using JQuery or Prototype seeing .NET JS makes me want to cry.- lichme5000, on 04/08/2008, -3/+4<picard>agreed</picard>
- jaythree9, on 04/08/2008, -4/+2thirded. quit digging him down n00bs, because he speaks the truth.
- intelliott, on 04/08/2008, -0/+3ASP.NET didn't generate that particular javascript. He wrote it in there himself for simplicity sake.
- gt1329a, on 04/08/2008, -0/+2You don't have to use the .NET generated JS proxy if you don't want to. As long as you set the content-type correctly, you can call the JSON serialized version of an ASMX service with any framework.
For example, using jQuery: http://encosia.com/2008/03/27/using-jquery-to-cons ... - jeffyjones, on 04/08/2008, -1/+4I've used the ASP.NET AJAX framework extensively, and it's not bloated at all. It's smaller than many of the other frameworks out there, in fact. Your comments are arbitrary and untrue.
- wilfulwilly, on 04/09/2008, -1/+1but but it's cool to bash anything M$.
I completely agree with you
- wilfulwilly, on 04/09/2008, -1/+1but but it's cool to bash anything M$.
- bacon_skoda, on 04/08/2008, -2/+1"At some time in your life and that time may be soon...."
yeah, right after the baby. - ufia, on 04/08/2008, -2/+2I remember the day when JavaScript was only an enhancement to the web site, you could still browse the site with JavaScript turned off, the pages still was fail safe so to speak, you would hardly notice any differences minus the added JavaScript functionalities. Nowadays web sites are too dependent on JavaScript, turn it off and suddenly you are left with a blank page or an unusable piece of ***** with unorganized blocs of text scattered all around the place, and non-working links hard coded in the script.
- broeks, on 04/08/2008, -0/+3It's just how it evolved. You need a client side scripting language to do cool things and avoid page refreshes and javascript was available. I guess you'll just have to keep it on.
- jdbholmes, on 04/08/2008, -6/+2Right .net sucks , PHP just relies on a rag tag bunch of open source solutions , memcache , jquery , apache , my sql , PEAR ,SOA and NO SUPPORT smart. Your all a bunch of LEMMINGS.
- vade79, on 04/08/2008, -0/+4PHP relies on PHP...the rest of your fodder is unrelated or comparable to windows, ie. apache=IIS, mysql=mssql...
- DavX, on 04/09/2008, -0/+1Not that I agree with him, but when working with products from one producer (Microsoft), there is a level of support and confidence in that the products -will- work with each other.
- AaronStatic, on 04/09/2008, -0/+1*you're
- vade79, on 04/08/2008, -0/+4PHP relies on PHP...the rest of your fodder is unrelated or comparable to windows, ie. apache=IIS, mysql=mssql...
- rayishu, on 04/08/2008, -0/+1whats this? a story on digg that doesnt have political propaganda and/or poeple getting hit in the nuts? dugg--
- bl4k3r, on 04/09/2008, -2/+5The correct title should be "How to Call Web Services using AJAX and .NET"
- jasonsalas, on 04/09/2008, -0/+1well done, Kirk! :-)
- mwakeham, on 04/10/2008, -0/+0"Your all a bunch of LEMMINGS".... Man if I had $0.02 for every time some smart *&^ss parroted that phrase. Shows that everyone just loves to follow the same trend in language as in actions, I guess.
