system.Net.WebException: The request failed with HTTP status 405: Method Not Allowed. Error in Calling Web Service Function

Hello Friends,

I am using a web service to get availability information. i have only following url

I added Web References to the VS 2008 project , then i tried C# proxy class created from wsdl tool

But when i am calling any function from code it gives following error system.Net.WebException: The request failed with HTTP status 405: Method Not Allowed.

Please check the following page

And click the Check Availability Button.

Please tell me what is wrong in following code or how to solve this,

AvailRequestSegment availSeg = new AvailRequestSegment();
        ows.availability.TimeSpan dt = new ows.availability.TimeSpan();
        dt.StartDate = DateTime.Parse(startDate);
        availSeg.StayDateRange = dt;
        availSeg.numberOfRooms = int.Parse(rooms);
        availSeg.numberOfChildren = int.Parse(children);
        availSeg.totalNumberOfGuests = int.Parse(members);
        availSeg.availReqType = AvailRequestType.Room;

        availSeg.totalNumberOfGuestsSpecified = true;
        availSeg.numberOfChildrenSpecified = true;
        availSeg.numberOfRoomsSpecified = true;

        //availSeg.membershipId = getMembershipId();

        AvailRequestSegmentList availSegList = new AvailRequestSegmentList();
        availSegList.AvailRequestSegment = new AvailRequestSegment[1];
        availSegList.AvailRequestSegment[0]= availSeg;

        AvailabilityRequest availRequest = new AvailabilityRequest();
        availRequest.AvailRequestSegment = availSegList.AvailRequestSegment;
        availRequest.summaryOnly = true;
        AvailabilityService availService = new AvailabilityService();
        availService.OGHeaderValue = getHeader(code);
        AvailabilityResponse availResponse=availService.Availability(availRequest);
        //return new AvailabilityResponse();
        return availResponse;


11/3/2008 4:23:32 PM 7071 articles. 0 followers. Follow

5 Replies

Similar Articles

[PageSpeed] 13

I don't know why the service is returning that error, but you've got a bug on your page. ny.js is invalid. Look at line 1.

Also, the left panel looked bad in IE7. I couldn't really see the "Check Availability" button.

John Saunders | MVP – Connected System Developer
11/3/2008 6:12:20 PM
It seems the url is incorrect. 
The WSDL contains a non-valid url endpoint for the service and the url you specified does not seem valid either. You specified the url of the WSDL but not of the service.
You should contact the service provider to get the correct address.
Web Services Performance, Interoperability And Testing Blog
11/3/2008 6:28:50 PM

Don't worry about the layout or javascript file.
error is not related to that,
Do you have any idea of the error returned by web service,
is that related to using .wsdl url instead of .asmx for something like that.
I search on internet also but didn't get anything

11/3/2008 6:35:58 PM

My only "worry" was that I was unable to click the button you asked me to click, because of the layout, and possibly because of the .js file.

A 405 error means that the type of HTTP request you made (the "method") is invalid for the URL to which you made the request. Issuing a SOAP request (which uses a POST method) to the WSDL address would give you this error, because the WSDL URL probably only supports a GET request.

Yes, you need to use the service URL to communicate with the service, and the WSDL URL to communicate with the WSDL.

John Saunders | MVP – Connected System Developer
11/3/2008 6:43:49 PM

Javascript error is removed, and i checked the file in IE6 layout in not correctly displayed but Check Availability button is displayed below More Options Button.

Please check if you can


11/3/2008 7:09:07 PM

Similar Artilces:

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

Web app calling Web service error The request failed with HTTP status 401: Unauthorized
I have a web site calling a web service which are both located on the same server.  Integrated windows authentication is being used on both the app and service.    When I start the web app from VS's IDE (code on server), it runs fine displaying "Hello world" and populating the dropdownlist. However, if I browse to the URL in IE, I get the following errorSystem.Net.WebException: The request failed with HTTP status 401: UnauthorizedI output the credentials used in the web app, and they are correct.Why would it run fine through the IDE but not browsing to the u...

DynamicPopulateExtender: Web Service call failed: 12152, Web Service call failed: 12031
Hi, I'm using a DynamicPopulateExtender to take the value of a SELECT dropdown and pass it to an onpage web service (defined with <System.Web.Services.WebMethod()> _ '<System.Web.Script.Services.ScriptMethod()>) and as PUBLIC SHARED FUNCTION myfunction(contextKey as string) as string. The function returns the html for a listbox. Everything seems to fire properly on the client but when the web service is called by the Javascript function, I get Web Service call failed: 12152 or Web Service call failed: 12031 Any pointers would be appreciated.  Do...

Web service in .NET from Java Web Service
Hi there,I'm pretty new to .net (although i have years of experience with the old vb 6, access 2k, as well as java)... and need some with perhaps either some syntax or something.Here is the wsdl.<wsdl:definitions targetNamespace="">−<wsdl:types>−<schema targetNamespace="GetBookInfoByISBN">−<complexType name="BookInfoType">−<sequence><element maxOccurs="1" minOccurs="0" name="Title" nillable="true" type="xsd:string"/><element maxOccurs=&quo...

HTTP status 405: Method not allowed when accessing a Web Service
HI! I am working with a Cassini server and one of the pages makes a call to a webservice, but I keep getting HTTP Status 405 Error when I try to execute functions on it. I have read that the 405 error refers to IIS security settings blocking certain actions (POST for instance), but since this is not IIS, I am very confused. Has anybody managed to have webservices respond using Cassini? Thanks. Where is your web service running? Is Cassini hosting your web service too? Did you narrow this down to your Cassini/ATL question you asked on 6/14?-DanThis posting is provided "AS IS&qu...

How do you know which web method has returned when your OnComplete function gets called after multiple requests to a web service?
var prm;function pageLoad() { prm = Sys.WebForms.PageRequestManager.getInstance(); if (!prm.get_isInAsyncPostBack()) { WebService.get_defaultFailedCallback(OnFailed); WebService.set_defaultSucceededCallback(OnComplete); WebMethod1(); Webmethod2(); } } function OnComplete (results) {  // e.g. if (webmethodcalled == 'WebMethod1') { } }  How do you tell which method has returned the result? Is there an event handler for each individual method that can be used?  Thanks I need to stop answering my own questions...

.NET web services Vs Java Web Services
Hello, does anyone know of a book or good source of information that compares .NET and Java Web Services? (I would like soemthing neutral if possible). I am thinking of approaching this subject for my dissertation? Many Thanks Rob Hi Rob, Last year I had to give a powepoint presentation on Web Services. I noticed some good books at barnes and noble that discussed the subject. These books were specific to Java and discussed Web Services in a very clear fashion. They gave some elementary examples that were easy to understand. I have not yet had the pleasure of creatin .NET Web Servi...

web service error: The request failed with HTTP status 401: Unauthorized.
I am doing the web service walk-through from here:,vs.80).aspx I get the error 'The request failed with HTTP status 401: Unauthorized'.  My app is using windows authentication, I made sure the web service folder has permissions for everyone to execute and that didn't work.  IIS has annonymous access checked. I'm not sure what else to do. Help? Another thing... I'm using the integrated web server that comes with Visual Studio... does using it change things? Hello. I've faced that error when I tried to use async pages (at...

Problem calling Web Service using the DynamicPopulate Extender
Hi, I'm quite new to ASP.Net AJAX so please forgive my ignorance.  I have downloaded and installed the RC1 version and am following through some of the tutorial videos.  I am having a problem with the Dynamic Populate Extender example.  I have created some asp controls with onclick events calling a javascript function.  From there I am attempting to use a dynamic populate extender control to call a web service - it's a function declared on that ASPX page as the tutorial explains in necessary and decorated with the System.Web.Services.WebMEthod AND System.Web.Script.Serv...

Exception while calling .NET web service | System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
Hi,   We have written a .NET web service which retrieves an xml file from the database. This web service is SSL secured and requires client certificates for connection.   Problem: The web service is throwing an exception while retrieving large files. It works fine when the file size is around 1 MB, but fails with a file size of around 65 MB with the following exception: System.InvalidOperationException: There is an error in XML document (1, 38455668). ---> System.IO.IOException: Unable to read data from the transport connection. ---> System.Net.Sockets.SocketException: ...

asynchronous call of web service method from another web service
I am calling a web service method from within another web service.  Both are called asyncrhonously. Webservice 1 is invokde from a consumer app and its completed event is assigned an event handler, this works ok  The webservice being called is itself invoking another webservice and asynchronously calling another web method, again Ive assigned an event handler to its completed event, which works.  My problem is how do i expose the ouput (a dataset) of the second web method to the first web method ? Hi, Please have a look at this article:

Calling a Web Service from a Web Service
Hello,I was looking for some feedback on calling a web service from within a web service. I've heard that it's not good practice (or not possible). I have a scenario where I think it might make some sense.Within our infrastructure, we've created a web service that handles incoming updates on the statuses of all processes. This has proven to be a good thing since it allows applications to communicate across server to make status updates. It's also used by third party developers and applications to communicate with our infrastructure.Along these lines ... we are planning to create a new compon...

How to call .net web service from Java web application?
Hi all,  I have a vb .net web service.How do i call .net web service from Java web application?What all resources I need?Can you please provide a sample application where a java application is invoking methods of .net web service? Thank you Hi, First I am not familiar with java language, but web services are universal operating system and language independent. It doesn't matter where the services is or in what language is written you just invoke it  and it gives you "replay".  Probably you must reffer to java consuming web services.   Regard...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

Web resources about - system.Net.WebException: The request failed with HTTP status 405: Method Not Allowed. Error in Calling Web Service Function -

Resources last updated: 1/18/2016 7:08:26 AM