Donnerstag, 6. Mai 2010

The request failed with HTTP status 405: Method not allowed - Webservice

Ich hatte vor ein paar Tagen einen Webservice in mein Projekt integriert. Dabei von einem Drittanbieter den Webservice als Webreference eingetragen, dazu die wsdl Adresse verwendet. Jedoch kam beim Testen einiger Methoden immer folgender Fehler: " The request failed with HTTP status 405: Method not allowed ". Im Internet habe ich nicht viel gefunden, ausser, dass man Einstellungen an der machine.config vornehmen sollte. Die Lösung war dann doch trivialer. Ich habe die wsdl Adresse im Browser aufgerufen. Dort im unteren Bereich die zuständige asmx Adresse gefunden. Die Url der Webservice Referenz überschrieben mit der asmx Url und schon hat es funktioniert. Resultat, wsdl ruft das Schema auf, asmx führt die Methode aus.
- überschreiben der Url heisst, die Klasse, welche ich aufgerufen habe über den Webservice, hatte eine Property mit Url, dort die asmx Adresse eingegeben und anschliessend den Request ausgeführt -
!Immer aufpassen ob es sich um http oder https handelt!

A few days ago, I integrated a third party web-service into my project. Therefore I created a web-reference and added the wsdl address of the web-service. When testing some calls to the methods of this service, I received the following error: " The request failed with HTTP status 405: Method not allowed ". On the internet I just found articles about changes in the machine.config. The solution was more trivial. I looked at the wsdl address in the browser and in the bottom part I found the asmx address for the web-service. I overwrote the property of the web-service reference and it worked. Result, wsdl calls the schema and asmx performs the methods.
- overwriting of the url means, that the class I called through the web-service, had a property called Url, and there I passed the asmx address und after that I performed the request -
!Always check if it is a http or https address!

Keine Kommentare:

Kommentar veröffentlichen