Soap and the rest on the same service returns status 404 / endpoint not found for soap endpoint

I am trying to configure two endpoints for the same leisure service, which is webHttpBinding, and one for soap, which is wsHttpBinding. but when I find a service for soap, it gives me no end point.

Here is my ITicketService.cs interface

[ServiceContract] public interface ITicketService { [OperationContract] [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "/tickets")] void AddTicket(Ticket ticket); [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "/tickets")] IQueryable<Ticket> GetAllTickets(); [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "/tickets/{id}")] Ticket GetTicketById(string id); [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "/tickets/show_many?ids={ids}")] IQueryable<Ticket> GetSeveralTicketsById(string ids); [OperationContract] [WebInvoke(Method = "PUT", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "/tickets/{ticket_id}")] void UpdateTicket(Ticket ticket, string ticket_id); } 

Here is the ticket service markup

 <%@ ServiceHost Language="C#" Debug="true" Service="TicketSupportSystem.Rest.Service.TicketService" Factory="System.ServiceModel.Activation.WebServiceHostFactory" CodeBehind="TicketService.svc.cs" %> 

Here is my actual service implementation

 public class TicketService : ITicketService { TicketManager _ticketManager = new TicketManager(); public void AddTicket(Ticket ticket) { _ticketManager.InsertTicket(ticket); } public IQueryable<Ticket> GetAllTickets() { return _ticketManager.GetAllTickets(); } public Ticket GetTicketById(string id) { int ticketId = Convert.ToInt16(id); return _ticketManager.GetTicketById(ticketId); } public IQueryable<Ticket> GetSeveralTicketsById(string ids) { var idList = ids.Split(','); List<Ticket> tickets = new List<Ticket>(); foreach (var item in idList) { tickets.Add(GetTicketById(item)); } return tickets.AsQueryable(); } public void UpdateTicket(Ticket ticket, string ticket_id) { int ticketId = Convert.ToInt16(ticket_id); ticket.Id = ticketId; _ticketManager.UpdateTicket(ticket); } } 

Here is my service configuration (web.config)

 <system.serviceModel> <bindings> <wsHttpBinding> <!-- or WsHttpBinding --> <binding name="wsHttpBinding" > <security mode="Transport"> <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" /> </security> </binding> </wsHttpBinding> </bindings> <services> <service name="TicketSupportSystem.Rest.Service.ITicketService" behaviorConfiguration="ServiceBehaviour"> <endpoint name="restTicketService" address="web" binding="webHttpBinding" contract="TicketSupportSystem.Rest.Service.ITicketService" behaviorConfiguration="web"> </endpoint> <endpoint name="soapTicketService" address="soap" binding="wsHttpBinding" contract="TicketSupportSystem.Rest.Service.ITicketService" > </endpoint> </service> <service name="TicketSupportSystem.Rest.Service.ITicketCommentService" behaviorConfiguration="ServiceBehaviour"> <endpoint address="" binding="webHttpBinding" contract="TicketSupportSystem.Rest.Service.ITicketCommentService" behaviorConfiguration="web"> </endpoint> <endpoint address="" binding="wsHttpBinding" contract="TicketSupportSystem.Rest.Service.ITicketCommentService" > </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> <service name="TicketSupportSystem.Rest.Service.IUserIdentityService" behaviorConfiguration="ServiceBehaviour"> <endpoint address="" binding="webHttpBinding" contract="TicketSupportSystem.Rest.Service.IUserIdentityService" behaviorConfiguration="web"> </endpoint> <endpoint address="" binding="wsHttpBinding" contract="TicketSupportSystem.Rest.Service.IUserIdentityService" > </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <endpointBehaviors> <behavior name="web"> <enableWebScript/> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior name="ServiceBehaviour"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

When I go to the URL http://example.com/TicketService.svc/tickets , it gives me the correct data for the rest destination

and

When I go to the URL http://example.com/TicketService.svc/soap , it gives me the endpoint not found.

therefore, it was not possible to create a proxy server for the soap service.

Thanks in advance for your time to view my question.

0
c # soap rest wcf wcf-binding
source share
1 answer

Hi, finally, I found a problem and cannot believe this stupid mistake.

 <service name="TicketSupportSystem.Rest.Service.ITicketService" behaviorConfiguration="ServiceBehaviour"> <endpoint name="restTicketService" address="web" binding="webHttpBinding" contract="TicketSupportSystem.Rest.Service.ITicketService" behaviorConfiguration="web"> </endpoint> <endpoint name="soapTicketService" address="soap" binding="wsHttpBinding" contract="TicketSupportSystem.Rest.Service.ITicketService" > </endpoint> 

In the code snippet above, the Service Name points to the ITicketService interface, which is incorrect; instead, it should focus on a specific TicketService implementation.

And also no need to mention

 System.ServiceModel.Activation.WebServiceHostFactory 

factory in service markup to run REST using a SOAP service.

0
source share

All Articles