PHP SOAP Request not working
Hello i am very new to webservice, in php with below code i am trying to
make soap request as shown in below XML, but it says Error
HTTP Error: Unsupported HTTP response status 405 Method Not Allowed
(soapclient->response has contents of the response)
Q. 1)how to pass headers 2)how to pass FetchCalendarRequest
i have used nusoap here but if u have soap php class solution is also
invited.
<?php
error_reporting(E_ALL);
require_once('../lib/nusoap.php');
$client = new
nusoap_client("http://webservices.test.com/ows/5.1/Availability.wsdl");
$err = $client->getError();
echo "<pre>";
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(),
ENT_QUOTES) . '</pre>';
exit();
}
// Call the SOAP method
$result = $client->call('FetchCalendar', array('StayDateRange' =>
array('StartDate' => '2013-10-01','EndDate' => '2013-10-10')));
// Check for a fault
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
// Display the result
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
}
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>
XML
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<OGHeader transactionID="005435"
timeStamp="2008-12-09T13:26:56.4056250-05:00"
xmlns="http://webservices.test.com/og/4.3/Core/">
<Origin entityID="OWS" systemType="WEB" />
<Destination entityID="WEST" systemType="ORS" />
</OGHeader>
</soap:Header>
<soap:Body>
<FetchCalendarRequest
xmlns:a="http://webservices.test.com/og/4.3/Availability/"
xmlns:hc="http://webservices.test.com/og/4.3/HotelCommon/"
xmlns="http://webservices.test.com/ows/5.1/Availability.wsdl">
<HotelReference chainCode="LEELA" hotelCode="LEELAMUM" />
<StayDateRange>
<hc:StartDate>2013-10-01</hc:StartDate>
<hc:EndDate>2013-10-10</hc:EndDate>
</StayDateRange>
<GuestCount>
<hc:GuestCount ageQualifyingCode="ADULT" count="1" />
<hc:GuestCount ageQualifyingCode="CHILD" count="0" />
</GuestCount>
</FetchCalendarRequest>
</soap:Body>
</soap:Envelope>
Post Url :http://000.000.000.00:8080/ows_ws_51/Availability.asmx
Soap Action :
http://webservices.micros.com/ows/5.1/Availability.wsdl#FetchCalendar
No comments:
Post a Comment