I am trying to configure two endpoints for the same service one for rest that is webHttpBinding and one for soap that is wsHttpBinding. but when I hit the service for soap it gives me no endpoint found.
Here is my interface ITicketService.cs
[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 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 url http://example.com/TicketService.svc/tickets it gives me correct data for rest endpoint
and
When I go to url http://example.com/TicketService.svc/soap it gives me Endpoint not found.
so not able to create proxy for soap service.
Thanks in advance for your time to review my question.