Welcome!

Linux Containers Authors: Liz McMillan, Yeshim Deniz, Elizabeth White, Mehdi Daoudi, XebiaLabs Blog

Related Topics: Linux Containers, Microsoft Cloud, Machine Learning

Linux Containers: Article

How To Create a Silverlight App That Consumes a POX Service

First off, it might be worth it to note that there is a Silverlight 'Quick Start' for performing this task

Kevin Hoffman's Blog

I realize that it might be a little early to evaluate the overall experience of doing something like this on a piece of Alpha software, but, I figure if Microsoft is going to assault the developer community with so many betas, alphas, gammas, zetas, and whatever else they can find - its my right as a developer to try out every last one of those products, alpha or otherwise.

First off, it might be worth it to note that there is a Silverlight "Quick Start" for performing this task. The problem is that the Quick Start sucks. It actually tells you to go off and follow the directions for creating a basic ASP.NET Web Service - which is wrong. In order to do this, you need to create a POX service using Orcas, not a WSDL-spewing bloat machine like the default ASP.NET .asmx services.

The key to creating a POX service with Orcas are a couple of attributes that I only wish were available right now in non-Orcas web services. First, you need to decorate your code-behind Web Service class as such:

[System.Web.Script.
Services.
ScriptService]

Secondly, for each method that you want to be accessible to scripts, you need to configure that method appropriate. It needs the standard WebMethod attribute, but it can also take another one:

[ScriptMethod(UseHttpGet=true)]

This allows your method to be accessed by scripts (no envelopes, just POX), and also informs the web service factory handler that this method is available through HTTP GET requests. At this point, you're probably thinking, "Yay! I've got a POX service!" ... well, almost. Something else that I didn't find in the Quick Starts is that the HTTP POST and HTTP GET protocols are not enabled by ASP.NET web services by default, you have to enable them in your web.config file with the following XML:

 <webServices>
        <protocols>
            <add name="HttpGet"/>
            <add name="HttpPost"/>
        </protocols>
 </webServices>

Now you actually have a POX service that is capable of returning some useful data to your AJAX scripts or, more currently, to your Silverlight Application.

I'll spare you the gorey details of creating the Silverlight application, and creating the ASP.NET "Silverlight link" that will copy the output files of your Silverlight app into your ASP.NET app for building, and just show you the code that I used to consume a simple POX data service method that returns a string. The output of the string is, in typical 'hello world' fashion, used to modify the contents of a TextBlock control:

public void HandleClick(object o, EventArgs e)
{
    BrowserHttpWebRequest req = new Browser
HttpWebRequest(new Uri(
   "http://localhost/silverdata/dataservice.
asmx/GetData?input=test"));

    HttpWebResponse response = req.GetResponse();
    StreamReader responseReader = new 
StreamReader(response.GetResponseStream());
    string rawResponse = responseReader.
ReadToEnd();
    Debug.WriteLine(rawResponse);
    XmlReader xr = XmlReader.Create(new
StringReader(rawResponse));
  
    xr.ReadToFollowing("string");
    xr.Read();
    labelText.Text = xr.Value;
}

So with all this in place, you can now create your XAML and have something like MouseLeftButtonUp (remember that you don't have Click (yet) in Silverlight..) invoke the POX service, get the data, and then repopulate data elements dynamically at runtime.

The next step here is to obviously do the call to the web service asynchronously (which is entirely possible, and actually pretty easy). I think the next thing I'm going to do as an experiment is to have the code in the Silverlight app modify an HTML element so that it changes to indicate that a data connection is being made in the background. Once the data is retrieved, the HTML element will be set back to normal and the data from the service will be used to populate some controls on the page. We'll see how that turns out :)

tags:        
links: digg this  del.icio.us  technorati  reddit

More Stories By Kevin Hoffman

Kevin Hoffman, editor-in-chief of SYS-CON's iPhone Developer's Journal, has been programming since he was 10 and has written everything from DOS shareware to n-tier, enterprise web applications in VB, C++, Delphi, and C. Hoffman is coauthor of Professional .NET Framework (Wrox Press) and co-author with Robert Foster of Microsoft SharePoint 2007 Development Unleashed. He authors The .NET Addict's Blog at .NET Developer's Journal.

Comments (1) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
.NET News 06/04/07 12:42:10 PM EDT

First off, it might be worth it to note that there is a Silverlight 'Quick Start' for performing this task. The problem is that the Quick Start sucks. It actually tells you to go off and follow the directions for creating a basic ASP.NET Web Service - which is wrong. In order to do this, you need to create a POX service using Orcas, not a WSDL-spewing bloat machine like the default ASP.NET .asmx services.

@ThingsExpo Stories
SYS-CON Events announced today that Massive Networks will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
SYS-CON Events announced today that CAST Software will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CAST was founded more than 25 years ago to make the invisible visible. Built around the idea that even the best analytics on the market still leave blind spots for technical teams looking to deliver better software and prevent outages, CAST provides the software intelligence that matter ...
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution and join Akvelon expert and IoT industry leader, Sergey Grebnov, in his session at @ThingsExpo, for an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
Because IoT devices are deployed in mission-critical environments more than ever before, it’s increasingly imperative they be truly smart. IoT sensors simply stockpiling data isn’t useful. IoT must be artificially and naturally intelligent in order to provide more value In his session at @ThingsExpo, John Crupi, Vice President and Engineering System Architect at Greenwave Systems, will discuss how IoT artificial intelligence (AI) can be carried out via edge analytics and machine learning techn...
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
In his session at @ThingsExpo, Arvind Radhakrishnen discussed how IoT offers new business models in banking and financial services organizations with the capability to revolutionize products, payments, channels, business processes and asset management built on strong architectural foundation. The following topics were covered: How IoT stands to impact various business parameters including customer experience, cost and risk management within BFS organizations.
SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
SYS-CON Events announced today that Pulzze Systems will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Pulzze Systems Inc, provides the software product "The Interactor" that uniquely simplifies building IoT, Web and Smart Enterprise Solutions. It is a Silicon Valley startup funded by US government agencies, NSF and DHS to bring innovative solutions to market.
From 2013, NTT Communications has been providing cPaaS service, SkyWay. Its customer’s expectations for leveraging WebRTC technology are not only typical real-time communication use cases such as Web conference, remote education, but also IoT use cases such as remote camera monitoring, smart-glass, and robotic. Because of this, NTT Communications has numerous IoT business use-cases that its customers are developing on top of PaaS. WebRTC will lead IoT businesses to be more innovative and address...
WebRTC is great technology to build your own communication tools. It will be even more exciting experience it with advanced devices, such as a 360 Camera, 360 microphone, and a depth sensor camera. In his session at @ThingsExpo, Masashi Ganeko, a manager at INFOCOM Corporation, will introduce two experimental projects from his team and what they learned from them. "Shotoku Tamago" uses the robot audition software HARK to track speakers in 360 video of a remote party. "Virtual Teleport" uses a...
When shopping for a new data processing platform for IoT solutions, many development teams want to be able to test-drive options before making a choice. Yet when evaluating an IoT solution, it’s simply not feasible to do so at scale with physical devices. Building a sensor simulator is the next best choice; however, generating a realistic simulation at very high TPS with ease of configurability is a formidable challenge. When dealing with multiple application or transport protocols, you would be...
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
In his session at @ThingsExpo, Dr. Robert Cohen, an economist and senior fellow at the Economic Strategy Institute, presented the findings of a series of six detailed case studies of how large corporations are implementing IoT. The session explored how IoT has improved their economic performance, had major impacts on business models and resulted in impressive ROIs. The companies covered span manufacturing and services firms. He also explored servicification, how manufacturing firms shift from se...
SYS-CON Events announced today that Elastifile will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Elastifile Cloud File System (ECFS) is software-defined data infrastructure designed for seamless and efficient management of dynamic workloads across heterogeneous environments. Elastifile provides the architecture needed to optimize your hybrid cloud environment, by facilitating efficient...
SYS-CON Events announced today that Golden Gate University will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Since 1901, non-profit Golden Gate University (GGU) has been helping adults achieve their professional goals by providing high quality, practice-based undergraduate and graduate educational programs in law, taxation, business and related professions. Many of its courses are taug...
Recently, WebRTC has a lot of eyes from market. The use cases of WebRTC are expanding - video chat, online education, online health care etc. Not only for human-to-human communication, but also IoT use cases such as machine to human use cases can be seen recently. One of the typical use-case is remote camera monitoring. With WebRTC, people can have interoperability and flexibility for deploying monitoring service. However, the benefit of WebRTC for IoT is not only its convenience and interopera...
When shopping for a new data processing platform for IoT solutions, many development teams want to be able to test-drive options before making a choice. Yet when evaluating an IoT solution, it’s simply not feasible to do so at scale with physical devices. Building a sensor simulator is the next best choice; however, generating a realistic simulation at very high TPS with ease of configurability is a formidable challenge. When dealing with multiple application or transport protocols, you would be...
WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web communications world. The 6th WebRTC Summit continues our tradition of delivering the latest and greatest presentations within the world of WebRTC. Topics include voice calling, video chat, P2P file sharing, and use cases that have already leveraged the power and convenience of WebRTC.
An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics ...
SYS-CON Events announced today that Secure Channels, a cybersecurity firm, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Secure Channels, Inc. offers several products and solutions to its many clients, helping them protect critical data from being compromised and access to computer networks from the unauthorized. The company develops comprehensive data encryption security strategie...