This is a migrated thread and some comments may be shown as answers.

Data not exposed as JSON when using 'WCF Restful service'

3 Answers 109 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ramakrishna
Top achievements
Rank 1
Ramakrishna asked on 18 Oct 2012, 05:52 AM
I trying to get work on WCF Restful service on a template 'WCF Service library'

implemented Domain model and Domain model service with the use of Telerik OA.
And configured endpoints for the service as well.

Now the tricky issue comes where the generated methods a. ReadAccountsByXML() and ReadAccountsByJson() both exposes only XML data why?

//Ramakrishna

3 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 22 Oct 2012, 03:14 PM
Hello Ramakrishna,

Could you please give us more details on how you created the service? Did you use the Add OpenAccess Service wizard or you created it manually?

Please note that you have to specify different Uri template for the methods serializing in JSON as well as set the ResponceFormat parameter of the WebGet attribute to Json. Here is how your method should look like:
[WebGet(UriTemplate = "?format=json", ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
ItemInfoList<Account> ReadAccountsByJson();

Please give this a try and let us know if it does not help.

Regards,
Alexander
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
0
Ramakrishna
Top achievements
Rank 1
answered on 25 Oct 2012, 07:05 AM
I used 'Add OpenAccess Service wizard' not manual.

I can see the specified attributes were there by default.

what might I missing to get work ?


//Ramakrishna
0
Alexander
Telerik team
answered on 29 Oct 2012, 04:22 PM
Hello Ramakrishna,

When you call the service, do you add the "?format=json" parameter to the Uri?
If possible, please give us more details about your method definition and the way you are calling it, so we could try to reproduce this behavior on our side.

Greetings,
Alexander
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
Tags
Web Services
Asked by
Ramakrishna
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Ramakrishna
Top achievements
Rank 1
Share this question
or