Mariano Ravinale's Blog

Sharing Experiences

Using Ria Services Soap and Windows Phone 7

with 4 comments

I remember last year or so at this time, I began to glimpse Ria Services, from that preview so far Ria Services grew strongly and became something more just than a framework for creating applications RAD (Rapid Application Development) for Silverlight.

Ria Services initially was conceived  to expose our business logic as a service, taking as a model our data access layer of EF, and get our domain in a client-side context to work with Silverlight in a dynamic manner, facilitating thus the development and access to data.

However for large scale applications we may have other requirements, such as: Exposing our services in a way that they can be consumed from other systems, or decouple the business logic from the services, to make it interchangeable or use other tools like workflow in the same, and/or perhaps also to decouple the data access layer to use other ORM than EF .

For both problems there are solutions that Ria Services team has implemented in order to continue using the facilities that it has given us working on Silverlight.
For now we will focus on the first problem, the interaction with other systems in the next article I`ll deal with the decoupling between layers.

With a friend we’ve share a vision of using RIA Services for an application that could access these services from external system in this case Windows 7 Phone!!!.

Make sure we have the latest version of Ria Services:

1. First of all we need to create a Web application in Asp.Net as Empty.

2. In this case, we can designate it as “SoapRiaService”.

3. Add a database where we will test our Employee table .

4. Then select Entity Framework 4 new item and write it the database conection name, you could use “SoapTestDbEntities”.

5. For this test and for now we will take the Employees table to create our mapping


6. Ok, we already have our entity Employee in our ORM. Now we need to do a solution build.

7. As a next step we need to create our domain service and get the interface for the basic CRUD operations in order to make it accessible to our client.
To achieve this we need to add a new component called Domain Service Class that is our Ria Service. In this case we may call it “EmployeeDomainService”.

8.  When we add a Domain Services class  using the wizard we can choose the entity that we need to apply the editing operations from the context of EF.
Choose properties enabling editing metadata generation, which will allow us to access the properties of validation of the entity, and also choose to expose an endpoint of Odate (REST)

9. For each method we add the decorator [invoke] in that way we generate the corresponding proxy methods in the client.

10) The Namespace and DomainServiceNameClass, give us a clue to find out the generated WCF service. The service address is:
1. http:// [host: port] / Services / [namespace] – [DomainServiceNameClass]. svc (the ‘.’ are replaced by ‘–’ )
2. Example: http://localhost:37390/Services/SoapRiaService-EmployeeDomainService.svc

11. Now we need to add the endpoint to access the SOAP services, if we do not want a REST enpoint , just remove the OData endpoint.

12. Having all the logic and configuration ready in our application we need to make sure to add the library Microsoft.ServiceModel.DomainServices.Hosting.dll address shown below.
But you have this path, be sure to install or reinstall WCF Silverlight RIA Services V1.0 for 4 and Visual Studio 2010

13. After adding the library and compiled the project, we just need to try it (F5) to be host in the IIS test server and then we can see our service at the following address:


14. If we want to see the WSDL Contract http://localhost:37390/Services/SoapRiaService-EmployeeDomainService.svc?wsdl

15. Now we’ve ready our service, to create our application in Windows Phone 7, first download the developer tools once installed create a new Windows project Panorama Phone Application (COOL!). use “WP7SoapRiaService” to name it, if you want.

16. Once created the application we’ll need to add a service reference as an address setting http://localhost:37390/Services/SoapRiaService-EmployeeDomainService.svc, then click on GO,at this time you should now see our service and operations exposed by Ria Services, rename the namespace to “EmployeeService” for example.

17. Let see the proxy classes that were created after giving Ok double clicking on the service reference.

18. Well now as a next step we could add the Reactive eXtensions(RX) reference ,
to control the asynchronous call to our Web Service, yap Reactive Extensions now comes within the Windows SDK Phone 7!!!.

19. Once you add the reference add the following code, on my last post I’ve explained RX, and I just added a spinner property to control the visibility:

20. Add a Spinner and bind it to the Visibility property, to control its visibility depending the data in our collection.

21. Run the application, and done you have the application ready!!

The first time when you execute this test you should be patience, because it could take a little longer time until you get the information from the server.

I Hope this post could be useful 😀

Project Download.

May the Code be with you!!!

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License


Written by @mravinale

septiembre 24, 2010 a 4:44 am

4 comentarios

Subscribe to comments with RSS.

  1. Hey Now,
    Great Post & excellent project on Codeplex!


    septiembre 30, 2010 at 10:08 am

    • I have tried for a long time to figure out what I have done wrong but I can not and clearly need help. When I add the Soap endpoint in step 11 I can no longer test the end point and get

      “Could not load file or assembly ‘Microsoft.ServiceModel.DomainServices.Hosting, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified”.

      If I coment out that line it test fine.

      Please Help!


      abril 5, 2012 at 2:47 am

      • Sorry I solved it. I had to Referance the SoapRiaToolKit


        abril 5, 2012 at 4:04 am

  2. […] Using RIA Services SOAP and Windows Phone 7 […]


Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )


Conectando a %s

A %d blogueros les gusta esto: