405 Method Not Allowed

I have the javascript function below which is attempting to make a jquery call to a simple .net function.

I am getting:
405 Method Not Allowed

This is my simple .net web service:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class ReportInput
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function HelloWorld() As String

Can anyone see what I am doing wrong?
function simsFunction() {
	    var settings = {requestType:"soap1.2",
	       error:function(XMLHttpRequest, textStatus, errorThrown){
	       throw XMLHttpRequest.responseText;
	     }};
     
		 var oBuffer = new Array();
		 settings.requestType = "soap1.2";
		 settings.methodType = "POST";
		 settings.contentType = "application/soap+xml; charset=utf-8";
		 //settings.url = "http://wsp-sandbox6.co.uk/ReportInput.asmx";
		 settings.url = "http://localhost:2256/CCBCWSTest/ReportInput.asmx/";
		 settings.dataType = "text/xml";
		  
		 settings.nameSpace = "http://tempuri.org/";
		 settings.methodName = "HelloWorld";
		
		 oBuffer.push('<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/soap/envelope/">');
		 oBuffer.push("<soap12:Body>");
		  oBuffer.push('<HelloWorld xmlns="http://tempuri.org/" />');      
		   oBuffer.push("</soap12:Body>");
		 oBuffer.push("</soap12:Envelope>");
		 settings.requestData = oBuffer.join("");
		 alert("requestData:" + settings.requestData);
  		   
		 $.ajax({
		   type: settings.methodType,
		   cache: false,
		   url: settings.url,
		   data: settings.requestData,
		   contentType: settings.contentType,
		   dataType: settings.dataType,
		   error: function(data,status){    	   	
		   	alert('data = ' + data.d);   	   	
		   },
			   success: function(data, testStatus){
			     alert('data = ' + data);	  
			   },
			   beforeSend: function(XMLHttpRequest){
			     if (settings.requestType == "soap1.1" || settings.requestType== "soap1.2")
			       XMLHttpRequest.setRequestHeader("SOAPAction",settings.nameSpace + settings.methodName);
			     XMLHttpRequest.setRequestHeader("Content-Length",settings.requestData.length);
			     XMLHttpRequest.setRequestHeader("Connection", "close");
			   }
		 });    
    }

Open in new window

scm0smlAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gery128Commented:
Try using Get method instead of Post

settings.methodType = "GET";  

instead of

settings.methodType = "POST";

Generally 405 means such kind of request is not allowed. Which may be configured thru IIS.
0
scm0smlAuthor Commented:
Same error I'm afraid?!
0
gery128Commented:
May I know why you are using complexe oBuffer object?

you can simply pass parameters directly to $.ajax function.

Refere this URLs

http://weblogs.asp.net/jalpeshpvadgama/archive/2010/08/29/calling-an-asp-net-web-service-from-jquery.aspx


http://encosia.com/using-jquery-to-consume-aspnet-json-web-services/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
santhimurthydCommented:
Are you developing the application in VS2005 else higher version.
0
scm0smlAuthor Commented:
2010
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.