7

I need to prepare a .Net SOAP Web Service which returns JSON format, we have to use those service in iPad & Android.

I searched a lot but found only WCF Restful service that return JSON and ASMX SOAP service that return XML.

Please help me to prepare a .Net SOAP web service which returns JSON data either WCF or ASMX (WCF recommended).

If possible please also let me know what is the standard format (WCF REST return JSON, WCF SOAP return JSON, ASMX SOAP return XML, etc.) to use .NET web-services with iPad/iPhone & Android.

himanshu
  • 442
  • 2
  • 7
  • 17
  • you can't return JSON from web-service. But you can create as json format string from your own. [Example](http://stackoverflow.com/questions/6705681/returning-json-in-asp-net-webservice) – शेखर Apr 16 '13 at 04:34

3 Answers3

4

Using WCF it is trivial to return JSON, and IOS developers will love you if you avoid SOAP. Since you didn't specify a version of .NET you require, I will point you to the latest and greatest feature called Web API. See the tutorial here http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api

Sergey
  • 2,303
  • 1
  • 18
  • 11
  • 2
    Thanks for your answer, yes you are correct IOS developers avoid SOAP but in my case our IOS developer needed SOAP service which return JSON format. I am using ASP.NET 4.0 not in MVC. Please suggest if it is possible. – himanshu Apr 16 '13 at 09:49
  • 3
    You cannot send JSON in SOAP message using standard libraries, because SOAP is XML. If you absolutely must use SOAP and JSON together, you can serialized to JSON and return it as a string within XML. Then you don't need web API, plain WCF service will do. – Sergey Apr 17 '13 at 03:46
  • Thanks for your valuable suggestions. I discussed with our IOS developers and decided to develop WCF Rest Service that return JSON. – himanshu Apr 17 '13 at 09:08
0

You can use WebAPI with Web Forms too http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-aspnet-web-forms

0

Think service stack library. You can use with an asp.net web form app or mvc app.

http://www.servicestack.net/

emremp
  • 524
  • 4
  • 12