?
Solved

Switching WCF with http binding from XML to JSON

Posted on 2013-11-20
9
Medium Priority
?
526 Views
Last Modified: 2014-01-10
Hi Experts,

     I have a WCF service hosted in a windows service with http binding using XML format for the messaging.  How do I change it from XML to JSON?

Thanks in advance...
0
Comment
Question by:axnst2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
9 Comments
 
LVL 25

Accepted Solution

by:
apeter earned 1800 total points
ID: 39665518
Decorate your wcf method with this

[WebInvoke(Method = "GET",
           RequestFormat = WebMessageFormat.Json,
           ResponseFormat = WebMessageFormat.Json,
           UriTemplate = "<method name>")]


Also you to have add in your config is "<webHttp/>" if it is not there .This should part of "behaviorConfiguration" value.
0
 

Author Comment

by:axnst2
ID: 39669066
Where would I add this exactly?  In the contract on the server side?
0
 
LVL 9

Assisted Solution

by:Grant Spiteri
Grant Spiteri earned 200 total points
ID: 39684224
Yes thats correct the attribute needs to be above your method, this can be either on the proxy implementation or on the method directly
0
Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

 
LVL 25

Expert Comment

by:apeter
ID: 39757544
Not fair....
0
 

Author Comment

by:axnst2
ID: 39759341
I'm so sorry apeter, I didn't even look...I just assumed the second respons was yours too!  I will see what I can do to correct my mistake!
0
 

Author Comment

by:axnst2
ID: 39759358
I have contected the Moderator...we'll see what happens.  Again, I appologise!
0
 
LVL 25

Expert Comment

by:apeter
ID: 39770181
Thanks a lot axnst2 :)
0
 

Author Comment

by:axnst2
ID: 39770935
No, thank you for the help!  I love this site!  You Experts save me so much time!
0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question