Select to view content in your preferred language

a question before starting with JavaScript API

1557
3
09-01-2011 04:47 AM
SangamLama
Emerging Contributor
Hi there,

I've written several ArcGIS Mapping applications on Silverlight/WPF platform before, but this is the first time I'm trying to get my hands dirty with JavaScript API. I went through the tutorials and samples, and I have a question regarding the difference between the two platforms.

I noticed that all the requests sent to ArcGIS server are done in JavaScript itself. What I mean to say is, while in Silverlight platform, I always wrote the core functions such as IdentifyTask, Buffer, GeometryTranslation etc in a WCF service. Then Silverlight would consume that service. That way, I used Silverlight only for input/output purposes. All the requests/responses to/from ArcGIS server were done in WCF, and handed back to Silverlight.

So, can I still consume a WCF service from JavaScript similarly? Or that isn't the way how things are done on this platform? And if former is the case, could anyone please post examples on how to do so?

Thanks
0 Kudos
3 Replies
derekswingley1
Deactivated User
The JS API provides classes that streamline communication with the ArcGIS Server REST API. Using the JS API to talk to other REST endpoints/web services to do things you mentioned (identify, buffer, projecting data) is possible but you would be re-inventing many things that are already in the API. Unless you have specific needs not covered by the API, I would say you do not need any WCF components.
0 Kudos
SangamLama
Emerging Contributor
Thanks Derek.

This WCF service I've mentioned serves as a wrapper on top of the REST services you folks have. The WCF service resides in our own framework. We do so mainly for re-usability and other purposes.

I also understand that a direct JavaScript to REST service communication is awful lot easier than the approach I'm trying to take, but it also means I'll have to write a lot of code in JavaScript that's already in the WCF service.

Hence, if it's possible to  provide some examples of JavaScript-WCF communication, I'd very much appreciate it.


The JS API provides classes that streamline communication with the ArcGIS Server REST API. Using the JS API to talk to other REST endpoints/web services to do things you mentioned (identify, buffer, projecting data) is possible but you would be re-inventing many things that are already in the API. Unless you have specific needs not covered by the API, I would say you do not need any WCF components.
0 Kudos
derekswingley1
Deactivated User
Sorry, I don't know of any examples showing using the JS API to talk to WCF services. Check out esri.request to talk to your WCF services. It's a wrapper on dojo.io.script.get and dojo.xhrPost.
0 Kudos