Tag Archive | Web Service

Consuming a .NET Web Service from iPhone

This was something which take me a whole (working) day to implement, and I’d like to share the new-found knowledge with everybody interested. We’ll use SOAP with a simple .asmx web service (for the sake of simplicity). I’ll only focus on setting up the connection, so tasks such as authentication and security are to be implemented by you.

First, we’ll need the service. Our simple little web service will return void, and take two parameters, a user name and an integer value representing the user’s score (yes it’s a high score table). The service will take care of putting these values into a database. The SQL table looks like this:

ID Primary key, Identity seed (1,1)
Name nvarchar(50)
Score Int

 
Read More…

Advertisements

Data-Driven Silverlight

I’m continuing the struggle with Silverlight, and I’d like to share my probably worst experience with you. I’d wanted to make a data-driven app in Silverlight recently, but it took a complete day. All I wanted was the binding of a MS SQL table to a Silverlight DataGrid. Because SL doesn’t support System.Data (which made me cry at the first place), I needed a workaround for this one. Then I found the template Silverlight-enabled WCF service, and it was love in the first sight, I thought. To bind a table (one-way binding, of course) in Silverlight is relatively easy. Create a service, set a reference on it, set it as the ItemSource property of the DataGrid. In code:

WebServiceSoapClient client = new WebServiceSoapClient();

client.GetCustomersCompleted += new EventHandler<GetCustomersCompletedEventArgs>(client_CustomersCompleted);

void client_CustomersCompleted(object sender, GetCustomersCompletedEventArgs e)

{

dataGrid1.ItemsSource = e.Result;

}

Easy as that.

Read More…