Any Webservice That Returns JSON?
May 11, 2010Does anyone know of free webservice that returns a list in the form of JSON? I have searched many webservice sites but they all return xml. Geonames.org is not required.
View 3 RepliesDoes anyone know of free webservice that returns a list in the form of JSON? I have searched many webservice sites but they all return xml. Geonames.org is not required.
View 3 RepliesI am working on a mvc project, and having problem with json. i have created a demo project with list of colors
public JsonResult GetResult()
{
List<string> strList = new List<string>();
strList.Add("white");
strList.Add("blue");
strList.Add("black");
strList.Add("red");
strList.Add("orange");
strList.Add("green");
return this.Json(strList);
}
i am able to get these on my page, but when i try to delete one color, that is when i send the following using jquery
function deleteItem(item) {
$.ajax({
type: "POST",
url: "/Home/Delete/white",
data: "{}",
contentType: "application/json; charset=utf-8",
success: ajaxCallSucceed,
dataType: "json",
failure: ajaxCallFailed
});
}
the controler action public JsonResult Delete(string Color) {} Color always returns null, even if i have specified "/Home/Delete/white" in the url. i know i am doing something wrong or missing something, but not able to find out what.
I have an asp.net page with a WebMethod on it to pass JSON back to my javascript. Bellow is the web method:
[WebMethod]
public static string getData(Dictionary<string, string> d) {
string response = "{ "firstname": "John", "lastname": "Smith" }";
return response;
}
When this is returned to the client it is formatted as follows:
{ "d": "{ "firstname": "John", "lastname": "Smith" }" }
The problem is the double quotes wrapping everything under 'd'. Is there something I've missed in the web method or some other means of returning the data without the quotes? I don't really want to be stripping it out on the client everytime. Also I've seen other articles where this doesn't happen.
I have a Page that expects a POST Request and returns some JSON. Essentially it's an .ashx Page, but that doesn't really matter.
When using jQuery, I would use jQuery.Post with "json" as dataType to simply make the POST request and get an object back. However, for the current project I mainly use ASP.net AJAX and I don't want to add jQuery just for the call.
For ASP.net AJAX, I only found information on how to call a "traditional" web service though, which means adding a asp:ServiceReference to the ScriptManager and having a "real" Web Service at the end.
Is there a simpler way to make a POST call to a Page? I could live with getting the raw JSON and then manually eval()ing it, but I don't want to create a full asmx web service (deploying them on SharePoint is a bit painful, and my ashx handler works fine)
I want to make a web servcie(.svc) that returns JSON data after entering the input.....which is resulted as in the downloaded filein JSON format.i want something like that-http://209.62.6.226/GracoRest/service.svc/Rest/WheretoBuyplease help me for the above but....step by step...i m trying WCF very 1st time
View 3 RepliesI am working with a .net 2.0 asmx webservice (code below)I need to return 4 "items", which will be based on the success of failure of the webservice, and the actual XML imput itself.The Webservice needs to be asyncronous.I have included the code below, but am happy for someone to re-do it as it's been built up on tutorials and examples.At present, I don't believe the async is working, and the returns don't seem to be getting done.I have also built a test harness, and testing, which allows me to send some custom XML and then receive the response.
[Code]....
Harness:
[Code]....
i work with visual studio 2005 and asp net 2.0 and i must to create a webservice who returns a xml as a string
this string must be use by an application java as i know ..
ok i can create the asmx and my web method who run a sql command BUT how i can return a xml as a string ?
[code]....
What's wrong?
Edit: And what if I need to return {Message:'',Type:1} ?
Edit2: The answer for the last one is: I can return a Dictionary<string, string>
So I have a WebMethod that I call using jQuery. The method is supposed to return a unique URL to a image file created dynamicly.
The WebMethod is called in a for loop so anywhere from 1 to 50 calls gets fired async.
The problem is that the webservice seems to be using the same instance of the object, so that it returns the same value to a couple of the requests.
[Code]....
Shouldn't the WebMethod create a new instance of the class for each call, so that all values are stored individually in memory?
[Code]....
I have a webservice (ASMX) which I have tested locally using built-in VS web server. It works fine in the Dev environment, and there was no configuration of anything in IIS for this kind of webservice to work.
Today when I deployed my site on the live server, I got a 500 error when the webservice is being called. The website doesn't work, and unfortunately the client did not test this on staging (same server)
Here's the sample call to my service.
$.ajax({
type: "POST",
url: 'http://www.mydomain.com/services/someservice.asmx/MyMethod',
data: "someid=564",
dataType: "xml",
success: function(msg){
}
In Firebug, http://www.mydomain.com/services/someservice.asmx/MyMethod returns error 500 internal server.
I called the service using jQuery AJAX, the live server is Windows Server 2008 Standard.
how to create a Web service that returns a JSON(or JSONP). That also should be able to work for cross-domain access aswell as for a local call.. help to get this working or for a few links for further reading about this
View 2 RepliesHow can we consume a web service using asp.net out put in json formate?
View 1 RepliesThe main issue is that I cannot run a webservice that accepts requests in JSON format. I keep getting a 500 Server error stating that the "request format is invalid." My ASP.NET AJAX extensions are installed. My server is running Plesk Control Panel 8.6 which is undoubtedly causing these problems.
The default handler for this specified extension is shown in the web.config like so:
For my applications webservice to handle JSON it needs to have this reference:
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Plesk is not allowing the request to be handled properly. I need to know the correct http directive(s) to put into the web.config to properly handle JSON webservices.
I have trouble with JSON response compression. I look to response headers after uploading website to production server (Windows 2008, IIS 7) and found uncompressed response. Turning on "Enabled static compression" and ""Enable dynamic compression" in IIS control panel does not effect. ASPX pages was responsed gzipped, but webservice response uncompressed.
I looked to google, but no answer found about this trouble. Also, I try this [URL] way (and adding to web.config this module) - but this source is excellent working at development machine with ASP.NET development server (and have seven times response size reduced) and totally ignored at IIS7.
How I can apply gzip compression to json responses from my webservice?
I need to make a call to a json webservice from C# Asp.net. The service returns a json object and the json data that the webservice wants look like this:
"data" : "my data"
This is what I've come up with but I can't understand how I add the data to my request and send it and then parse the json data that I get back.
string data = "test";
Uri address = new Uri("http://localhost/Service.svc/json");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
request.Method = "POST";
request.ContentType = "application/json; charset=utf-8";
string postData = "{"data":"" + data + ""}";
How can I add my json data to my request and then parse the response?
I have two parameters (categoryName and categoryDescription) that I need to pass to the web service using JSON. I found the syntax to pass categoryName but have not been able to get the correct syntax to pass both parameters. Here is the code.
<script src="js/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
[code]...
I have successfully returned data from a ASP.Net webservice in JSON format (using a service method that required no parameters) but have struggled with making a webservice call that requires a parameter.
Webservice:
<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=True)> _
Public Function TestWebService(ByVal Description As String) As Stock
Dim res As New Stock(Guid.NewGuid, Description)
Return res
[Code]....
I'm working with a webservice call after doing
[Code]....
[Code]....
Some strange problem have occured while developing application. Some WCF webservice returns object with date property.On client this web service is called using Jquery.ajax.Then result is parsed using json2.For date I simply use following expressions:
var reMsAjax = /^/Date((d|-|.*))[/|\]$/;
a = reMsAjax.exec(value);
if (a)
var b = a[1].split(/[-+,.]/);
return new Date(b[0] ? +b[0] : 0 - +b[1]);
unfortunatelly if browser timezone differs simple new Date with milliseconds not works.Time will be based on timezone.
i want to get data from my database and dispaly it in my web page using json with webservicei'm going to post my code i create a webservice and add method which return string to get all data so my code like this
[Code]....
and in my page
[Code]....
I have a website where I am using the JSON webservice. I have uploaded my website on the server.
Problem:
When I try to access the webservice it gives me the error as shown in below screenshot. In the below screenshot MyServices is my webservice. MyServices.asmx is the name of the file that I am trying to access.
Troubleshooting that already has been done:
I tried cleaning the bin folder and rebuilding again. But it didnt work.
We have a problem regarding webservices when it runs in https. it say's that the service is undefined. BUT when we try it in http it runs okay...
View 1 RepliesI have a simple webservice that I would like to upload a file to. The problem is that I need the response in json.
Form my experience in order to get a response in Json my request has to have a content-type of 'application/json'. But ofcourse this cannot be the case with a file upload since the content type will have to be 'multipart/form-data'.
In my Json i want to return a value showing whether successful and a filename.
[code]...
I have been trying for two months to get this code working, and I am close, but still confused. I want the JQuery UI Autocomplete function to call an web service which returns JSON data and display that data for selection, and on selection put the selected value into a hidden field.
There are several issues:
1) The autocomplete function is not firing
2) The source: "/AutoSuggest.asmx/DOTFind?" line throws an invalid object exception
3) The service requires two parameters: (string prefixText, int count) - count tells it how many records to return.
4) I am not at all certain that this code will accept JSON data that comes back from the service
Here is the code:
[code]....
How to create a JSON webservice in ASP.NET that connect to MS SQL Database and update/delete values from the database?
This webservice will eventually be used to communicate with iPhone SDK.