I am new in RESTful and WCF services and I'm making a RESTful with a JSON message format. When I run this service it gives no response.
This is my code:
[ServiceContract]
public interface IPersonas
{
[OperationContract]
[WebInvoke(Method="GET",BodyStyle=WebMessageBodyStyle.Bare,
ResponseFormat=WebMessageFormat.Json,UriTemplate="getPeople")]
Persona[] getPeople();
}
[DataContract]
public class Persona
{
[DataMember(Name="nombre")]
public string nombre { get; set; }
[DataMember(Name="apellido")]
public string apellido { get; set; }
}
And my implementation:
public Persona[] getPeople()
{
List<Persona> list = new List<Persona>()
{
new Persona(){nombre="luis",apellido="romeor"},
new Persona(){nombre="alberto",apellido="calderton"},
new Persona(){nombre="erick",apellido="romeor"},
new Persona(){nombre="miguel",apellido="calderon"}
};
return list.ToArray();
}
When I access Personas.svc/getPeople/ it gives no response. Sometimes the service opens on the service host test.