I want to create a webservice which can be used in Ipad takes argument through coding from the app in Ipad and returns a JSON. The webservice should be in .NET. Can please anyone help me?
JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
return js.Serialize("Abc");
Not returning a value. When we use Get Method.
You want the service to run on an iPad, or be accessible from an iPad? If the former, then I’m not sure what you’re trying to do. If the latter, then it really has nothing to do with an iPad.
In .NET there are a number of ways to create a service which returns JSON. Keep in mind in this regard that “web service” doesn’t have to mean WCF or SOAP or anything like that. It’s just a resource on the web. For example, if you have an MVC site then you can simply return string content from your controller and use the JavaScriptSerializer to serialize your objects to JSON.
From the perspective of the consuming client it doesn’t really care how the JSON is created on the server, it just needs a JSON-parsable string. Something like this:
Here I’m just serializing the string “testing” but you can pass any object to the
Serialize()method (provided that it’s serializable).