Saturday, January 24, 2009

Consuming ArcGIS Server SOAP services in Silverlight 2.0

Microsoft's Silverlight platform offers yet another application environment in which to consume SOAP services. The Silverlight platform is truly tantalizing - the ability to blend\mash\mix services and data with a rich user experience in a web client is undeniably sexy and powerful. Unfortunately some of the backend plumbing still needs to be worked out. This includes Silverlight's ability to consume SOAP services, let alone ArcGIS Server's SOAP service stack. Sure, everyone's talking about REST and WCF, but W3C standard, contract based, explicitly typed interaction with SOAP services is still prevalent - just take a look at the recent release of the Virtual Earth Web Service SDK.

So how do you consume a SOAP service in a Silverlight application or class library? Once you install the Silverlight tools with Visual Studio (or Web Developer) 2008 sp1 you will be provided with a context menu item off the project in Solution Explorer. The item is named "Add Service Reference" and opens a dialog box for a developer to define the endpoint to a service (WCF,SOAP) and a namespace for the native client types that will be generated.

This capability is synonymous with the "Add Web Reference" capability for SOAP services in standard .NET projects. A single url to a WSDL is used to construct a SOAP proxy and a set of value object types. This provides a nice interface for one-off services, but if you have a set of services that share value object types and you want to generate a single library with a single namespace, you need to use a command line tool. This is possible with the NET 2.0 and 3.5 SDKs which include the web service utilities wsdl.exe and svcutil.exe, respectively. Note, wsdl.exe output is supported in .NET 2.0 - 3.5. Unfortunately Silverlight does not provide the same or similar utility. Before Silverlight 2.0 final was released, a utility named slwsdl.exe was available for this purpose. Unfortunately it was removed from the 2.0 final release for reasons unknown. In addition, the output from wsdl.exe and svcutil.exe will not work with Silverlight applications. Both wsdl.exe and svcutil.exe generate references to types that are not available in the Silverlight platform. Problematic type references generated in svcutil.exe output can be removed so reference code can actually be built as a Silverlight class library. Unfortunately the proxy class includes both synchronous and Begin\End asynchronous methods. Neither pattern is supported in a Silverlight application. In fact, the Silverlight "Add Service Reference" tool only generates Async\Completed asynchronous methods, which is the "promoted" pattern for event-based asynchronous programming. Apparently there is no way to trigger svcutil.exe to only generate the appropriate asynchronous methods for Silverlight and synchronous methods are not officially supported in Silverlight, apparently due to cross-browser support issues.

So with all this in mind, how can you generate a single library that contains all the proxy classes and value object types for all ArcGIS Server service types? It’s hokey, but you need to manually merge all WSDLs into a single WSDL – being careful to place the element types in the same locations (e.g. element vs. operation, etc.). You only need to do this once since the library you generate will be distributable thus reusable for all Silverlight applications\libraries. In fact, the sample included with this post includes the reference class file generated from this process, so you don’t need to mess around with the ArcGIS Server WSDLs – just download the sample and compile the ArcGIS_SOAP_Silverlight project. Or just use the precompiled ArcGIS_SOAP_Silverlight.dll in the bin folder.

The sample is available here.

The sample also contains a Silverlight application that illustrates a simple use case for consuming an ArcGIS Server dynamic map service and navigating the map. Left mouse click on the map zooms in, Shift+left mouse click zooms out. Note you’ll need Visual Studio 2008 sp1 and the Silverlight tools to load and build the projects in the solution (see for more info). You can give a test run below. It's designed to be instructive, so it's pretty simple.

One additional note, the Web site that hosts the ArcGIS Server services must have a clientaccesspolicy.xml(Silverlight) or crossdomain.xml(Flex) in place to support cross domain\site requests. Silverlight will work with either. If using crossdomain.xml the following entry will enable SOAP interaction for all consumers:

<allow-http-request-headers-from headers="*" domain="*">


ShailGIS said...


Thank you for the sample on SOAP with silverlight ... How about taking your SimpleSOE SOAP sample and integrate with the silverlight?

Is it possible?



Unknown said...

Thanks for this article, definitely helpful. would be nice to see an example of what ShailGIS proposed, consume the SOE extension in the sl application.. cheers

Sumant said...

ArcGIS Server makes it easy for organizations to share mapping services and applications across the Web.

With ArcGIS Server, you can

* Connect more people with the information they need to make better decisions.
* Publish fast, intuitive Web mapping applications and services tailored to your audience.
* Simplify access to your services, data, and imagery.

ArcGIS Server supports desktop, Web-based, and mobile workflows. It helps you protect and manage your mapping information, and it provides a scalable platform that satisfies everything from the simplest to the most complex Web mapping requirements.

Recently I just came across a good articles on " Windows Server"
Here is its link.

Jay Ockers said...


Thanks for putting this sample up. I ran into a hole in the REST API and it made my life much easier to drop this in and just use the SOAP API without missing a beat.

Raffay said...

This kind of information is very limited on internet. Nice to find the post related to my searching criteria. Your updated and informative post will be appreciated by blog loving people.

cpanel reseller |
reseller web hosting

Dainius Bekeris said...

Hi Rex.

Can you write some words about working against different ArcGIS versions when using SOAP interfaces. I was looking for information regarding SOAP and different ArcGIS releases, but found nothing. If I want to build SOAP client that works with 9.3, 10 and 10.1 will I need to import WSDL from each ArcGIS version and switch between version proxies depending to which ArcGIS installation I connect? Or server supports older WSDL versions and proxy generated from 9.3 WSDL can make requests to 10.1?

hai said...

Dear Rex,Sorry to comment here regarding the link

There is no option for sharing questions.Thats what I selected here to post comment based on the above link.

If we use googlemap height and width <=640 then No issue,Everything will work perfectly.
But If I will use more than that of height and width,Then the graphics will show out of the location after zoom and pan.

I dont know how to solve this issue!!!!!!I need googlemap with morethan 640 height and width in my application.Can u help me to solve this???

I pasted the VB code here in the following link .Expecting reply...

Unknown said...

Everyone loves it when folks get together and share opinions. Great website development company

Unknown said...

Hi, A very smart idea, when designing websites, is to overlay your Web Design Cochin on a real net browser. There are web sites that you can visit to test your design and denote a browser size. thanks........

bharat shinde said...

Nice info..
Website Designers Mumbai

Vimax Suplemen Pembesar Mr.P Pria said...

artikelnya sangat membantu gan thanks for sharing :)

Web Design & Development said...

This is a good article & good site.Thank you for sharing this article. It is help us following categorize:
healthcare, e commerce, programming, multi platform,inventory management, cloud-based solutions, it consulting, retail, manufacturing, CRM, technology means, digital supply chain management, Delivering high-quality service for your business applications,
Solutions for all Industries,packaged applications,business applications, Web services,
Business intelligence, Business Development, Software Development etc.

Our address:
2002 Timberloch Place, Suite 200
The Woodlands, TX 77380


Unknown said...

I would like to thank you for your nicely written post
i like play games friv online and play games2girls Download baixar facebook

Unknown said...

Thanks for sharing. I hope it will be helpful for too many people that are searching for this topic.
download free descargar whatsapp and download baixar whatsapp online and descargar whatsapp gratis , baixar whatsapp gratis

Unknown said...

Very interesting! Thanks you
Jugar juegos de frozen en línea gratis, los nuevos de princesa de Disney juegos frozen - la princesa encantadora y linda. Divertirse frozen!

Unknown said...

Its really good information, i like your blog post. Thanks for sharing
download descargar facebook gratis para Android celular and download free descargar facebook apk en español, descargar facebook plus , descarga facebook

Unknown said...

Great stuff. This is really a fascinating blog, lots of stuff that I can Get into. One thing I just want to say is that your Blog is so perfect!
happy wheels
super mario bros

Unknown said...

You need to kill time, you need entertainment. Refer to our website. hope you get the most comfort.
Thanks you for sharing!
Friv Games

ffff said...

you'd have time to look these kids active. Please visit our website and let us play the game interesting.
Thanks for sharing !
Friv 10
Kizi 10
Yepi 2

Unknown said...

You need to kill time, you'd have time to look these kids active. Refer to our website. Hope you get the most comfort.
Thanks for sharing !
Friv 5
Kizi 1
Yepi 3

ffff said...

When you're tired, you want to relax after a stressful working hours, you need to have time to take care of the kids active.
Please visit our website and play exciting flash games.Thanks you for sharing!
Friv 4

Unknown said...

Play the Best Free Games! We've picked out the racing games, cooking games, candy crush, games shooting, fashion games, ...
Thanks for sharing !
Kizi 200
Friv 1

trump Ivanka said...

invites you to play games for a chance to win cars Corolla Altis car

Friv Games
Kizi 100
Kizi 5

Unknown said...

Welcomes to google terminal keep sharing such ideas in the future as well.
google snake this was actually EARN TO DIE
what i was looking for,and i am glad to came here! AGE OF WAR 2
Hi! I’ve been reading your blog for a while HAPPY WHEELS
I want you to thank for your time of this wonderful read!!! Slitherio
Amazing insight you have on this, Slither io This article always blew me BIG FARM

ffff said...

You want to relax after a stressful working hours. Refer to our website. hope you get the most comfort.
Thanks for sharing !
Friv 100
Friv 8
Friv 2

Unknown said...

You want to relax after a stressful working hours. Refer to our website. Hope you get the most comfort.
Thanks for sharing !
Kizi 100

Anonymous said...

You need to have time to take care of the kids active. Please visit our website and play exciting flash games.
Thanks you for sharing!
Kizi 1000
Friv 3

Unknown said...

The blog or and best that is extremely useful to keep I can share the ideas. Age Of War 2
Big Farm | Slitherio | Tank Trouble
Of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.
Happy Wheels | Goodgeme Empire |

Unknown said...

Thanks for sharing this good stuff! Keep up the great work, we look forward to reading more from you in the future!
Friv 100

Unknown said...

You want to relax after a stressful working hours. Refer to our website. Hope you get the most comfort.
Thanks for sharing !
Kizi 100
gold Miner 2
unfair Mario 2
cubefield 2
tanki Online 2

Friv Games
Friv 200