You can use RIA services as a normal WCF service with several clients. For example as Excel OData-Source or as data delivery service for your Windows Phone 7 application. To achieve this goal you have to install the latest RIA Services Toolkit and do a little configuration work.
Reference for Microsoft.ServiceModel.DomainServices.Hosting
Add a reference of Microsoft.ServiceModel.DomainServices.Hosting to your RIA Services project.
It is important that you choose the version which was shipped by the RIA Services (Silverlight) toolkit. The standard standard assembly from the SDK does not contain the SoapXmlEndpointFactory and JSonEndpointFactory.
So take this one:
For the OData endpoint you need the System.ServiceModel.DomainServices.Hosting.OData assembly from the SDK directory.
Configure the endpoints
Configure the Json, Soap and OData endpoints in the web.config:
Using of RIA Services in your Windows Phone 7 application
To use the rias service (Soap endpoint) in your Windows Phone 7 application you have only to add a new reference and enter the Uri of your ria service.
Your Uri consists of the <namespace of your ria service>-<classname of your ria service>.svc where “.” are replaced with “-“ !
Now you can create a proxy client and access to your Domainservice methods:
Uri of all endpoints
The Uri for our exposed endpoints are:
SOAP: http://localhost:[portnumber]/<namespace of your ria service>-<classname of your ria service>.svc
With these exposed endpoints, you can talk to multiple clients:
- Excel Power pivot - Using the OData endpoint
- Windows Phone 7 – Using the SOAP endpoint
- AJAX client – Using the JSON endpoint