I'm trying to call remote SOAP XML web service via jQuery Ajax and I got 405 error, that I'm really don't understand why. In the code everything is seemed correct. Here is it below.
<script>
$(document).ready(function () {
$("#Button1").click(function () {
var SoapMessage = "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><soapenv:Body><hb:getHotelValuedAvail xmlns:hb='http://axis.frontend.hydra.hotelbeds.com' xsi:type='xsd:String'><HotelValuedAvailRQ echoToken='DummyEchoToken' sessionId='iuqmxlafic3i0bfbpvrnkdi4' xmlns='http://www.hotelbeds.com/schemas/2005/06/messages' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.hotelbeds.com/schemas/2005/06/messages HotelCategoryListRQ.xsd' showDiscountsList='Y' version='2011/01'><Language>ENG</Language><Credentials><User>SomeUser</User><Password>SomePassword</Password></Credentials><PaginationData pageNumber='1' itemsPerPage='999'/><CheckInDate date='20130913'/><CheckOutDate date='20130914'/><Destination code='BKK' type='SIMPLE'/><OccupancyList><HotelOccupancy><RoomCount>1</RoomCount><Occupancy><AdultCount>2</AdultCount><ChildCount>0</ChildCount></Occupancy></HotelOccupancy></OccupancyList><ExtraParamList><ExtendedData type='EXT_DISPLAYER'><Name>DISPLAYER_DEFAULT</Name><Value>PROMOTION:Y</Value></ExtendedData></ExtraParamList></HotelValuedAvailRQ></hb:getHotelValuedAvail></soapenv:Body></soapenv:Envelope>";
$.ajax({
url: "http://testapi.interface-xml.com/appservices/http/FrontendService",
data: SoapMessage,
dataType: "xml",
type: "POST",
processData: true,
contentType: "application/xml",
success: function (data, status, req) {
alert(req.responseText + " " + status);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("fu");
}
});
});
});
</script>
This is answer from the server:
HTTP/1.1 405 OPTIONS not supported
Date: Thu, 12 Sep 2013 11:43:52 GMT
Server: Resin/2.1.17
Cache-Control: no-cache
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Content-Type: text/html; charset=ISO-8859-1
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 136