WCF / ASMX :: JQuery & WCF Data Service - PUT Update - Rejected With 405 Method Not Allowed
Sep 12, 2010
I am writing a sample jQuery/WCF Data Service app to utilize OData, however I am getting a status code 405 - Method not allowed when I attempt to update an entity with a PUT Http method. I have configured my WCF Data Service as follows:
[Code]....
I am attempting to update the jCredentials_PINs table. My jQuery call to update the WCF Data Service is as follows:
[Code]....
I am using Windows 7 / IIS 7.5. GETs against the jCredentials_PINs table work fine. The only web.config configuration information is as follows:
How can allow this page to run on IIS server...It does not work on localhost..... it works when I open it directly... It gives the error "it is not allowed...!
The working Example..! I want this.. ""
the Erorr:
<html> <head> <script src="jquery.js" type="text/javascript" language="javascript"></script> <script src="jquery.xml2json.js" type="text/javascript" language="javascript"></script> <script> function sayHello(msg) { alert(msg); } function dcSetRate(obj,value){ document.getElementById(obj).value = value.toFixed(4); } function dcSet(obj,value){ document.getElementById(obj).value = value; }......
I am using JQuery & JSON (POST) to call webmethod. However I can call only webmethod located at aspx file but not in asmx file Below are sample codes
CustomValidate.asmx Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Public Class CustomValidate Inherits System.Web.Services.WebService 'ACCESS VIA JSON <System.Web.Services.WebMethod()> _ Public Shared Function AJAX_Test(ByVal date1) As Boolean... Return True End Function End Class Javascript: JQuery JSON function isDates(source, arguments) { var isValidDate; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "CustomValidate.asmx/AJAX_Test", data: '{date1: "' + arguments.Value + '"}', dataType: "json", async: false, success: function(result) { isValidDate = result; }, error: function(httpRequest, textStatus, errorThrown) { alert("status=" + textStatus + ",error=" + errorThrown); } }); arguments.IsValid = isValidDate; }
It always return javascript undefined error. But if I put the AJAX_Test webmethod in aspx page and replace the url: "CustomValidate.asmx/AJAX_Test" to "mypage.aspx/AJAX_Test". It works fine.
I'm a bit new to the whole asp.net thing so this is probably a silly question, but here it goes: I have created a WCF Data service based based on a ADO.net Entity--it's very basic:
I want to create a WCF Service to transfer data to our clients application(WPF). The Data I am trying to send is as follows.
ID Code Description unit Rate 1 104200000 LIVE GOAT NOS 25 2 104200000 LIVE GOAT2 NOS 25 3 104200030 LIVE GOAT3 KGS 10 4 104202030 Water LTR 5
and so on till ~ 11000 records.
What I have done so far is. Created a service which return a list of data.
public List<Classes.TariffData> GetTariffData() { var currentTariffData = new List<Classes.TariffData>(); using (var myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)) { const string query = "select a.ID,a.Code,a.Description,a.unit,a.rate,a.rate3 from tariff.dbo.tariffdata a, tariff.dbo.code_history b where a.id = b.id and b.endofvalidity is null"; using (var myCommand = new SqlCommand(query, myConnection)) { using (var ad = new SqlDataAdapter(myCommand)) { var dt = new DataTable("tariff"); ad.Fill(dt); currentTariffData.AddRange(from DataRow row in dt.Rows select new Classes.TariffData { Id = int.Parse(row["Id"].ToString()), Code = row["Code"].ToString(), Description = row["Description"].ToString(), Unit = row["unit"].ToString(), Rate = row["rate"].ToString(), Rate3 = row["rate3"].ToString() }); return currentTariffData; } } } } Class is as follows public class TariffData { public int Id { get; set; } public string Code { get; set; } public string Description { get; set; } public string Unit { get; set; } public string Rate { get; set; } public string Rate3 { get; set; } }
If i Limit the number of data by using const string query = "select top 300 a.ID,a.Code,a.Description. The Service works fine. But if I remove the top 300 part I get an error. What is your advice if I want a service to allow our client applications to update their data by using WCF. (11000 records.) I am using visual Studio 2010. C# .Net 4.0
I added a Web Method to the existing web service. I don't see this method in my web project. I can see all the old methods but I couldn't access this method. Do I have to create proxy for this method?
I'm using a web service and I want to return a list to my client. I am nearly newby at web services and I can't return a List<String> object to my client. But when i call the method it says "Unable to cast object of type 'System.Collections.Generic.List`1[System.String]' to type 'System.String[]'" What should I do?
I'm trying to consume a web service, after adding it to my project,I can't find any method inside,all classes.objects of those classes only contains set and get.Per-method Permissions.
we need to expose a web service to the 3rd party vendor which can only call using POST protocol, NOT SOAP.So my question, is it better to build a web service or just simply .aspx page?Also is there any best practice documentation on this.
For example, we are going to consume web method GetEmployeeByQuery(ConnInfoXML, Query, RecordDetail), ConnInfoXML is login information in XML, Query is a SQL statement selecting records, RecordDetail is all records retrieved. All data are in XML format.
So how to write these parameters in XML to consume this web method and get all the information in XML, and then transfer XML to normal string format ?
I have a web service called service1. Is it possible to pass the parameter related to the service to a class library so for e.g.
Service1.service ws = new Service1.service(); Service1.UserDetails ud = null;
now if I call a method that exists in a class and pass ud. Cam i do that because I am trying to do this and I am getting an error. Do i need to add a web
reference to this service in the class library My method call is like this
authenticateUser.Authenticate(ud, UserName);
and in the class libary I have
public void Authenticate( Service1.UserDetails ud , string UserName) { }
I would like to pass xml document to a method in WCF service by client that server will get xmldocument,parse it and send back the xml response.What are best practice for thi?The xml document is conform to XSD so i would like to create managed type that represent the schema and then expose thatIf anybody has done it before or know any example please point it out so i can see it.
I have a web service that has a CreateReport method that generates a report based on the specified criteria.
When I call this method Synchronously using a Windows Application or Console Application, the call works fine and the report is created.
When I call this method ASynchronously (CreateReportASync) using Windows Application the report is created.
When I call this method ASynchronously (CreateReportASync) using Console Application the web service does not even get the call.
I am using VS2005 and .Net Framework 2.0. So the proxy is automatically created with the Async methods. I am not really interested the result of the method call, so I do not add a Callback Delegate.
I have stopped the application pool, then replaced the XrfUploadService.cs file behind my XrfUploadService.asmx file. I now get errors when I do this: CS0101: The namespace '<global namespace>' already contains a definition for 'XrfUploadService'. What is this about and how can I update my service's code?
I am trying to call an asmx service using the jQuery ajax call-
[Code]....
I have double checked the url of the service and spelling/case of the name of the method as well as the parameters in the dataStr.
I still get the error-<b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. review the following URL and make sure that it is spelled correctly.
I have a test web service called: MySimpleService.svc with a method called:GetUserNamesByInitials. below is the Linq to SQL code:
[OperationContract] public static string GetUserNamesByInitials(string initials) { string result = ""; [code]...
what I do is to type the user id in one textbox (TextBox3) and when I press the Tab key the result is shown in another textbox(TextBox4). The jQuery call works well with other methods that do not call the database, for example using this other web service method it works:
[OperationContract] public string ParameterizedConnectionTest(string word) { return string.Format("You entered the word: {0}", word); }
However with the Linq method it just does not work.
am building jQuery UI sortable to store order in the database using serialize and ASP.NET Web Service. I know how to do it in php, but I am not sure how to do it in ASP.NET... I tried googling with little success.