Wednesday, March 21, 2012

Is ATLAS to be used with web-services only?

Is it just me, or is ATLAS designed to be used along with web-services?

Every example I see has web-services as the data-source.

All I am looking for is...can I use ATLAS in conjunction with server-side code, and NOT use web-services.

Btw...me new to ATLAS or AJAX for that matter...and am just starting to learn it.

Thanks,

Sashidhar

No. If you do a bit more reading/research, you'll see that Atlas is like any other AJAX product in terms of what you can do. Web Service is just a convenient method of serving as a data source.

jcasp:

No. If you do a bit more reading/research, you'll see that Atlas is like any other AJAX product in terms of what you can do. Web Service is just a convenient method of serving as a data source.

And what are the other options?


hello.

well, i guess that it is fair to say that you have 2 approaches: client-side or server-side. when you use client-side, you tipically perform postbacks through web method calls (here you have 2 options: expose the method through a web service or simply put the method on your page and annotate it with the webmethodattribute).

if you want, you can also use a server-side approach. in this case, you use updatepanels to wrap the portions of the page that should be refreshed through AJAX and don't really need to change much in your ASP.NET code.

Luis Abreu:

when you use client-side, you tipically perform postbacks through web method calls (here you have 2 options: expose the method through a web service or simply put the method on your page and annotate it with the webmethodattribute).

So basically when you use client side calls you can call only webmethods i.e. soap services.

Am I correct?

Thanks


Most of the ATLAS client controls will use web services when issuing post backs to the server, e.g. the AutoComplete behavior, data sources, etc. So, the short answer to your question is yes, client side calls are made using Web Services. Keep in mind that calls made to web services are actually done using JSON at runtime by default, I believe a new capability was added in the March CTP, that allows you to make service calls using SOAP if you need to. If you don't want to use a service, you could use the AtlasRuntime library, which essentially wraps the XmlHttpRequest object to make a "raw" AJAX request to do something like this:

var request = new Sys.Net.WebRequest();
request.set_url("MyHandler.ashx");
request.completed.add(this.onCompleted);
request.invoke();


yortch,

forgive me for the lame question but by raw AJAX request you actually mean raw XML request, right?


Yes, by AJAX request I meant an HTTP request issued using the JavaScript XmlHtttpRequest object.

Though note that even though it uses XmlHttpRequest, Atlas does not use SOAP & XML to call web services. Instead, it uses JSON. The nameXmlHttpRequest can be confusing in this respect.

David


So we can not call a standard ASMX service before it is JSON enabled. Correct?

And we can use Atlas client side library to call any JSON enabled service no matter if it written on .NET or not. Is that right?

I need to match the dictionary in AJAX world. I have not used AJAX before. Sorry if my questions bore you.

Thanks


You don't really need to do anything to JSON enable your asmx services. If they are on your Atlas site, they are callable via Atlas.

As for your second question, JSON is only a serialization format, and there are many ways you can call a web service using JSON. Until there is a standard that everyone follows (like SOAP for XML), Atlas client code can only call Atlas services.

Also, note that cross domain browser limitations generally make it hard to call different servers from client calls. So in most cases, you are calling back to your own server, and you know it has Atlas on it.


I got it.

Thanks davidebb!


What I am not quite able to figure out quite yet is...how many web-services would I have to write for providing a richer interface to any client, if I have a ton of fields on my webform.

Isn't the idea of having too many web-services kinda a performance hit on its own??Surprise [:O]

-Sashidhar


Even if you have "a ton of fields" in your webform you could use a single web service call. JSON requests at runtime are lighter than SOAP (XML) requests, the request still need to be de/serialized, but this is something you can't get away from if you'll be using AJAX. If you're concerned about perfomance look into trying to minimize the number of server side requests issued using ATLAS, i.e. if you can get the data you need to populate your form or whatever it is you're trying to achieve, try to achieve this with one request. If you're concerned about using Web Services at all, then look into either using the ATLAS runtime directly (which will require writing more javascript code), or use server controls such as the UpdatePanel. Hope this helps...

No comments:

Post a Comment