0

So, I learned a very hard lesson that the WCFTestClient is not meant to test/debug/develop WCF Web Services with JSON. There is an ability to customize the client configuration file within WCFTestClient to bind web services, but maybe that's for future-proofing when and if WADL becomes more commonplace.

How can I create a C# application which will consume this JSON-enabled WCF Service? Or, must I test it in the browser?

Thank you.

1
  • You can test it in the browser - as long as you use only the GET verb. For more advanced and more powerful testing of REST services, use Fiddler - free and very very powerful! Commented Jun 13, 2013 at 5:00

1 Answer 1

1

I'm assuming you are creating these services by using the WebInvoke/WebGet attributes on your method signatures. You can import these services just like you would any other service into a C# project, however VS doesn't add the additional attributes in the signature to the created code once you import them. You can show all files, and go into your service reference, under Reference.svcmap, into the Reference.cs file and add the attribute to the signature in the interface for your service, they will then allow you to send and/or receive them with JSON.

For example make sure they both your service interface and the imported interface have:

[WebInvoke(ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)] 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.