I have an ASP.NET web application.
It has a web service, with several web methods.
All of these web methods are based on the default settings. For instance:
using System.Web.Services;
namespace WebApplication2
{
[WebService(Namespace = "http://mydomain.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class WebService1 : WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
public Person GetPersonById(int id)
{
Person result = new Person();
// code...
return person;
}
}
}
The response is in SOAP (XML) format.
My question: Can I change the response's format to JSON, based on an input parameter or on a header?