Silverlight Authors: Automic Blog, Michael Kopp, AppDynamics Blog, Kaazing Blog, Steven Mandel

Related Topics: Silverlight, Machine Learning

Silverlight: Blog Feed Post

Calling the Enterprise Search Web Service from Silverlight 3

I tried this once before in a beta version of Silverlight 2 and it was much more difficult at the time


Now, we get to write code.  Add whatever controls you want to in your XAML file.  You can use Expression Blend to do this or just edit the file manually.  You’ll need a textbox or something to contain the results of the search query.  WCF calls in Silverlight have to be executed asynchronously, so you need to write an event handling method to the QueryEx call like this.

QueryService.QueryServiceSoapClient queryService = new QueryServiceSoapClient();

queryService.QueryExCompleted += new EventHandler<QueryExCompletedEventArgs>(queryService_QueryExCompleted);

To call the web service it works very much like any other .NET application.  Build an input XML document and make a call to QueryExAsync.  In my case I actually get the input from a textbox so that the user can provide the value to query on.

StringBuilder queryXml = new StringBuilder();


queryXml.Append("<QueryPacket xmlns=\"urn:Microsoft.Search.Query\" Revision=\"1000\">");

queryXml.Append("<Query domain=\"QDomain\">");










queryXml.Append("<QueryText language=\"en-US\" type=\"STRING\">");








We still need to implement the queryService_QueryExCompleted event handling method to get the results and display them in the textbox.

void queryService_QueryExCompleted(object sender, QueryExCompletedEventArgs e)


    ResultsTextBox.Text = e.Result.Nodes[1].ToString();


Now one thing I have noticed here is that the results XML string does not look exactly like the one that would normally come back as if it was called from a regular .NET application.  I am know Silverlight or WCF expert but I am sure there is a reason for this.  What ends up happening is that e.Results has a Nodes collection with 2 XElement in it.  The first one contains mostly schema information and the second one contains the actual results.  However, some initial data at the top of the tree (such as result count and page size) really is nowhere to be found (from what I can tell).  At this point, you are good to parse and bind the XML data as you please.  Here is what my ugly Silverlight application looks like.


I have attached the code to this post, so that you can use it as a starting point.  If you run into issues, I warn you Silverlight won’t give you a lot of help.  I recommend checking out this post on Debugging Web Services in Silverlight from the Silverlight team.  This is a bit of work to do now.  I can definitely say I am looking forward to the Client Object Model (publically announced a few weeks ago) in SharePoint 2010 which should make this easier..

Read the original blog entry...

More Stories By Corey Roth

Corey Roth, a SharePoint Server MVP, is an independent consultant specializing in Cloud technologies such as Azure and Office 365. He also specializes in mobile development. Corey serves as the product manager for two cloud-first mobile app platforms: BrewZap and HappenZap.

IoT & Smart Cities Stories
Digital Transformation is much more than a buzzword. The radical shift to digital mechanisms for almost every process is evident across all industries and verticals. This is often especially true in financial services, where the legacy environment is many times unable to keep up with the rapidly shifting demands of the consumer. The constant pressure to provide complete, omnichannel delivery of customer-facing solutions to meet both regulatory and customer demands is putting enormous pressure on...
SYS-CON Events announced today that IoT Global Network has been named “Media Sponsor” of SYS-CON's @ThingsExpo, which will take place on June 6–8, 2017, at the Javits Center in New York City, NY. The IoT Global Network is a platform where you can connect with industry experts and network across the IoT community to build the successful IoT business of the future.
The best way to leverage your Cloud Expo presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering Cloud Expo and @ThingsExpo will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at Cloud Expo. Product announcements during our show provide your company with the most reach through our targeted audiences.
Machine learning has taken residence at our cities' cores and now we can finally have "smart cities." Cities are a collection of buildings made to provide the structure and safety necessary for people to function, create and survive. Buildings are a pool of ever-changing performance data from large automated systems such as heating and cooling to the people that live and work within them. Through machine learning, buildings can optimize performance, reduce costs, and improve occupant comfort by ...
@DevOpsSummit at Cloud Expo, taking place November 12-13 in New York City, NY, is co-located with 22nd international CloudEXPO | first international DXWorldEXPO and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time t...
CloudEXPO New York 2018, colocated with DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
DXWorldEXPO | CloudEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
Disruption, Innovation, Artificial Intelligence and Machine Learning, Leadership and Management hear these words all day every day... lofty goals but how do we make it real? Add to that, that simply put, people don't like change. But what if we could implement and utilize these enterprise tools in a fast and "Non-Disruptive" way, enabling us to glean insights about our business, identify and reduce exposure, risk and liability, and secure business continuity?
In this Women in Technology Power Panel at 15th Cloud Expo, moderated by Anne Plese, Senior Consultant, Cloud Product Marketing at Verizon Enterprise, Esmeralda Swartz, CMO at MetraTech; Evelyn de Souza, Data Privacy and Compliance Strategy Leader at Cisco Systems; Seema Jethani, Director of Product Management at Basho Technologies; Victoria Livschitz, CEO of Qubell Inc.; Anne Hungate, Senior Director of Software Quality at DIRECTV, discussed what path they took to find their spot within the tec...
The deluge of IoT sensor data collected from connected devices and the powerful AI required to make that data actionable are giving rise to a hybrid ecosystem in which cloud, on-prem and edge processes become interweaved. Attendees will learn how emerging composable infrastructure solutions deliver the adaptive architecture needed to manage this new data reality. Machine learning algorithms can better anticipate data storms and automate resources to support surges, including fully scalable GPU-c...