RIA Services - exposing SOAP endpoint


This article speaks about how to expose SOAP endpoint in RIA Services. Sometime you may want to enable same business logic and data available to client other than Silverlight, this is very useful in that kind of scenario. SOAP service can be consumed by WPF and WinForm application also SOAP is very famous model in other technologies like Java.

To enable SOAP endpoint the domain service don't need any changes, you have to just add SOAP endpoint in Web.config

<domainServices>
      <endpoints>
        <add name="JSON" type="Microsoft.ServiceModel.DomainServices.Hosting.JsonEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="Soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </endpoints>
</domainServices>

The URL of SOAP endpoint is combination of namespace and domain service name.

http://localhost:52878/Services/RIASample-Web-StudentDomainService.svc

1.gif
 
Here is the wsdl of SOAP endpoint.

2.gif 

You can add service reference in your application and start using SOAP endpoint.

Up Next
    Ebook Download
    View all
    Learn
    View all