locked
Cannot connect to SOAP endpoint RRS feed

  • Question

  • Hello,

    I have a Silverlight 5 app with RIA Services, it works great but now a have a wpf application I need to connect to one of the services from a wpf application.

    I created the wpf application and added the service reference without a problem but when I try to use the auto-generated proxy to connect to one of my operations I recive the following error:

    There was no endpoint listening at http://localhost:1375/Services/MedicBase-Services-MonitorDomainService.svc/Soap that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

    Then the inner exception contains this message:

    The remote server returned an error: (404) Not Found.

    This is my app.config (wpf app):

     <system.serviceModel>
            <client>
                <endpoint address="http://localhost:1375/Services/MedicBase-Services-MonitorDomainService.svc/Soap"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_MonitorDomainServiceSoap"
                    contract="MonitorService.MonitorDomainServiceSoap" name="BasicHttpBinding_MonitorDomainServiceSoap" />
            </client>
            <bindings>
                <basicHttpBinding>
                    <binding name="BasicHttpBinding_MonitorDomainServiceSoap" />
                </basicHttpBinding>
            </bindings>
            
        </system.serviceModel>

    And this is the code I'm using to connect:

    private async void LoadPractitionersIds()
    		{
    			this.monitorContext = new MonitorDomainServiceSoapClient();
    			this.monitorContext.Open();
    			QueryResultOfMonitorParactitionerModel result = null;
    			string[] names = Properties.Settings.Default.Practitioners.OfType<string>().ToArray();
    			try
    			{
    				result = await monitorContext.GetPractitionersIdsAsync(names);
    			}
    			catch (Exception ex)
    			{
    				//Add error handling here
    			}
    			if (result != null)
    			{
    				this.practitionersIds = result.RootResults.Select(r => r.Id).ToArray();
    			}
    			else
    			{
    				this.practitionersIds = null;
    			}
    			monitorContext.Close();
    		}

    And finally this is my service:

    [EnableClientAccess()]
    	public class MonitorDomainService : DbDomainService<MedicDbContext>
    	{
    
    		[Query]
    		public IEnumerable<MonitorAppointmentModel> GetPractitionerAppointments(Guid[] practitionerIds)
    		{
    			DateTime now = DateTime.Today;
    			IEnumerable<MonitorAppointmentModel> appointments = (from a in DbContext.AppointmentEntities
    																 where practitionerIds.Any(p => p == a.AgendaId) &&
    																	   a.Date == now &&
    																	   (a.State == AppointmentState.Waiting ||
    																		a.State == AppointmentState.WFTWaiting ||
    																		a.State == AppointmentState.WLWaiting ||
    																		a.State == AppointmentState.WLWFTWaiting)
    																 select new MonitorAppointmentModel
    																 {
    																	 Id = a.Id
    																 }).AsEnumerable();
    			return appointments;
    		}
    
    		[Query(IsComposable = false)]
    		public MonitorAppointmentModel GetAppointment(Guid appointmentId)
    		{
    			MonitorAppointmentModel appointment = (from a in DbContext.AppointmentEntities
    												   where a.Id == appointmentId
    												   select new MonitorAppointmentModel
    												   {
    													   Id = a.Id,
    													   Location = a.Place.Place,
    													   												   }).FirstOrDefault();
    			return appointment;
    		}
    
    		[Query]
    		public IEnumerable<MonitorParactitionerModel> GetPractitionersIds(string[] names)
    		{
    						IEnumerable<MonitorParactitionerModel> models = (from u in DbContext.Users
    															 where names.Any(n => n == u.UserName)
    															 select new MonitorParactitionerModel
    															 {
    																 Id = u.UserId
    															 }).AsEnumerable();
    			return models;
    		}
    	}

    Any ideas???

    EDIT: I have published my web project (server) on my local IIS server and now the soap endpoint in accessible from the wpf app without problems. I use IIS express on VS2012... is there any known limitations on IIS express concerning soap endpoints????

    Thank you very much in advance and happy new year 2014 for all of you.


    • Edited by jcgalveza Saturday, December 28, 2013 5:10 PM
    Saturday, December 28, 2013 3:27 PM

Answers

  • Hi,

    According to your description, you need to add a reference to the Microsoft.ServiceModel.DomainServices.Hosting assembly and open the web.config file. Under the OData endpoint, add this new endpoint:

    <add name="Soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, 
                           Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, 
                           PublicKeyToken=31bf3856ad364e35" />

    As the default client of WCF RIA service is Silverlight, we need to do other settings when we want to use WPF client to visit WCF RIA Service.

    You can get the details from the blogs below:

    How to open a WCF RIA Services application to other type of clients: the SOAP endpoint (3/5)

    HowTo: Access a WCF RIA DomainService from a WPF client

    Based on my understanding, this issue is more related to WCF and I'd like to suggest you to post the question in WCF forum if you have further questions.

    Hope it helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 31, 2013 7:43 AM
  • FYI, the endpoints are now in the RIAServices.Endpoints NuGet package which will also automatically updates the web.config


    http://www.openriaservices.net | RIA Services and MVVM http://bit.ly/pgL97k

    Tuesday, December 31, 2013 3:06 PM

All replies

  • Hi,

    According to your description, you need to add a reference to the Microsoft.ServiceModel.DomainServices.Hosting assembly and open the web.config file. Under the OData endpoint, add this new endpoint:

    <add name="Soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, 
                           Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, 
                           PublicKeyToken=31bf3856ad364e35" />

    As the default client of WCF RIA service is Silverlight, we need to do other settings when we want to use WPF client to visit WCF RIA Service.

    You can get the details from the blogs below:

    How to open a WCF RIA Services application to other type of clients: the SOAP endpoint (3/5)

    HowTo: Access a WCF RIA DomainService from a WPF client

    Based on my understanding, this issue is more related to WCF and I'd like to suggest you to post the question in WCF forum if you have further questions.

    Hope it helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 31, 2013 7:43 AM
  • FYI, the endpoints are now in the RIAServices.Endpoints NuGet package which will also automatically updates the web.config


    http://www.openriaservices.net | RIA Services and MVVM http://bit.ly/pgL97k

    Tuesday, December 31, 2013 3:06 PM