views:

915

answers:

3

I have a functioning SL4 application (VS2010, SL4, WCF RIA, hosted on my dev box using Cassini, 64-bit Windows 7). Inside the ClientBin directory I have an .svc file that describes my service:

<% @ServiceHost Service="MyApp.Services.MyServiceFactory="System.ServiceModel.DomainServices.Hosting.DomainServiceHostFactory" %>

When I browse to http://localhost:52878/ClientBin/MyApp-Services-MyService.svc I see the following:

You have created a service. To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: svcutil.exe http://localhost:52878/ClientBin/MyApp-Services-MyService.svc?wsdl

I want to access that service from a Windows Service application. My understanding is that I need to enable SOAP end-points in order to make this happen. So, I add the following to my web.config file:

<domainServices>
  <endpoints>
    <add name="soap" type="System.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </endpoints>
</domainServices>

Firstly, Intellisense complains about the presence of the tag, saying:

The element system.ServiceModel has invalid child element domainServices.

Secondly, the aforementioned Silverlight application stops working, presumably because this change breaks the underlying web services.

Thirdly, it appears that the System.ServiceModel.DomainServices.Hosting assembly doesn't actually contain the SoapXmlEndpointFactory type; if I try to browse to the service after adding the above to web.config I see:

Could not load type 'System.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory' from assembly 'System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

If I inspect the assembly using Reflector, I see that it contains the DomainServiceEndpointFactory and PoxBinaryEndpointFactory types, but no SoapXmlEndpointFactory.

Could someone please let me know how I should be doing this? I can't believe that it should be this hard to simply consume a WCF RIA service in something other than a Silverlight application!

+1  A: 

Have you tried just executing

svcutil.exe http://localhost:52878/ClientBin/MyApp-Services-MyService.svc?wsdl

Alternatively, have you installed the RIA Services toolkit? http://www.microsoft.com/downloads/details.aspx?FamilyID=7b43bab5-a8ff-40ed-9c84-11abb9cda559&amp;displaylang=en

It's required for SOAP and JSON endpoints

Doobi
Duncan Bayne
+2  A: 

The SoapXmlEndpointFactory is part of the Microsoft.ServiceModel.DomainServices.Hosting assembly which is included in the Silverlight Toolkit.

See here

Ardman
A: 

I have the same problem with the domainServices .... saying "The element system.ServiceModel has invalid child element domainServices." but unfortunatelly those steps doesn't fix the problem. I'have the RIA Services and RIA Service Toolkid installed, set to TRUE the Copy Local of .Hosting assemly and I thing the declaration of domainServices is also correct

<sectionGroup name="system.serviceModel">
  <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication"  requirePermission="false"/>
</sectionGroup>

Could someone give me any other tip ... ?! Thanks!

Dannny
This doesn't address the original question; I suggest asking a new question of your own.
Duncan Bayne