I have been reading lot of posts on retrieving/returning json objects in a WCF method. Correct me if I am wrong: Adding an endpoint and WebHTTp behavior in the config in add
Yes it is possible. JSON and SOAP need different bindings so your service needs two endpoints - one with webHttpBinding
and webHttp
endpoint behavior and second with basicHttpBinding
or other SOAP oriented binding. These endpoints must have different relative addresses.
If you want to support both JSON and XML (POX not SOAP) formats in REST service you can do it on the same endpoint in WCF 4 by defining automaticFormatSelectionEnabled="true"
in the webHttp
behavior used for the REST endpoint. This allows the endpoint to return the data formatted either as JSON or as XML. The choice of the format is based on the format of incoming request so a request in JSON will get a response in JSON and a request in XML will get a response in XML.