未捕获的 SoapFault 异常:[HTTP] 错误请求


Uncaught SoapFault exception: [HTTP] Bad Request

我正在尝试发出 Soap 请求,我说此错误:

未捕获的 SoapFault 异常:C:'' 中的 [HTTP] 错误请求

<?php
$client = new SoapClient(null, array('location' => "http://webservices.micros.com/ows/5.1/Availability.wsdl#FetchCalendar",
                                     'uri'      => "http://###.###.###.##:8080/ows_ws_51/Availability.asmx?wsdl"));
//print_r($client);
$para = array('StayDateRange' => array('StartDate' => '2013-10-01','EndDate' => '2013-10-10'),'GuestCount'=>array('GuestCountageQualifyingCode'=>'ADULT','GuestCountageQualifyingCode'=>'CHILD'));

$ns = 'http://webservices.micros.com/og/4.3/Availability/'; //Namespace of the WS.
//Body of the Soap Header.
$headerbody = array('OriginentityID' => 'OWS',
                    'DestinationentityID' => 'WEST',
                    'systemType'=>'WEB',
                      'systemType'=>'ORS');
//Create Soap Header.       
$header = new SOAPHeader($ns, 'OGHeader', $headerbody);       
//set the Headers of Soap Client.
$client->__setSoapHeaders($header);
$client->__soapCall("FetchCalendar", $para);

?>

我的代码出了什么问题?

添加异常处理后:http://postimg.org/image/6w9lmac1d/

编辑:添加了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.micros.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.micros.com/og/4.3/Availability/" xmlns:hc="http://webservices.micros.com/og/4.3/HotelCommon/" xmlns="http://webservices.micros.com/ows/5.1/Availability.wsdl">
      <HotelReference chainCode="AXA" hotelCode="AXAMUM" />
      <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>

我相信有 2 层问题,首先你在抛出异常时没有抓住它。 其次,您的请求可能不正确/无效,这就是为什么它返回 400 个错误请求

try{
      $client->__soapCall("FetchCalendar", $para);
}catch (SoapFault $exception){
      //or any other handling you like
      var_dump(get_class($exception));
      var_dump($exception);
}