title: Create raw XML request using PHP SoapClient
body: <p>I am trying to create raw XML request with SoapVar. Here is my code</p>
  <pre><code>#- Loading the WSDL document
    $wsdl = &quot;https://ota2-p1.ihotelier.com/OTA_Seamless/services/DailyRateService?wsdl&quot;;
    $client = new SoapClient($wsdl,array('trace' =&gt; true, 'exceptions' =&gt; true));
  
  #- Creating the XML document
     $xml = &lt;&lt;&lt;EOT
  &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:wsa=&quot;http://www.w3.org/2005/08/addressing&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:ota=&quot;http://services.ota.travelclick.com&quot;&gt;
  &lt;soap:Header&gt;
     &lt;wsa:MessageID&gt;86830&lt;/wsa:MessageID&gt;
     &lt;wsa:ReplyTo&gt;
        &lt;wsa:Address&gt;NOT NEEDED FOR SYNC REQUEST&lt;/wsa:Address&gt;
     &lt;/wsa:ReplyTo&gt;
     &lt;wsa:To&gt;https://ota2-p1.ihotelier.com/OTA_Seamless/services/DailyRateService&lt;/wsa:To&gt;
     &lt;wsa:Action&gt;DailyRate&lt;/wsa:Action&gt;
     &lt;wsa:From&gt;
        &lt;SalesChannelInfo ID=&quot;XXXXXXXXX&quot;/&gt;&lt;!-- Fields to be provided by TC --&gt;
     &lt;/wsa:From&gt;
     &lt;wsse:Security xmlns:wsse=&quot;http://schemas.xmlsoap.org/ws/2002/07/secext&quot;&gt;
        &lt;wsu:Timestamp xmlns:wsu=&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&quot;&gt;
           &lt;wsu:Created&gt;2016-02-05T15:55:56+00:00&lt;/wsu:Created&gt;
           &lt;wsu:Expires&gt;2016-02-06T15:56:06+00:00&lt;/wsu:Expires&gt;
        &lt;/wsu:Timestamp&gt;
        &lt;wsse:UsernameToken&gt;
           &lt;wsse:Username&gt;XXXXX&lt;/wsse:Username&gt;&lt;!-- Fields to be provided by TC --&gt;
           &lt;wsse:Password&gt;XXXXXX&lt;/wsse:Password&gt;&lt;!-- Fields to be provided by TC --&gt;
        &lt;/wsse:UsernameToken&gt;
     &lt;/wsse:Security&gt;
  &lt;/soap:Header&gt;
  
  &lt;soap:Body&gt;
  &lt;OTA_HotelAvailRQ Version=&quot;2.0&quot; AvailRatesOnly=&quot;False&quot; TimeStamp=&quot;2016-02-05T15:55:56+00:00&quot;&gt;
     &lt;POS&gt;
        &lt;Source&gt;
           &lt;RequestorID Type=&quot;1&quot; ID=&quot;&quot; MessagePassword=&quot;&quot;/&gt;&lt;!-- Fields to be provided by TC --&gt;
           &lt;BookingChannel Type=&quot;18&quot;&gt;
              &lt;CompanyName CompanyShortName=&quot;&quot; Code=&quot;&quot;/&gt;&lt;!-- Fields to be provided by TC --&gt;
           &lt;/BookingChannel&gt;
        &lt;/Source&gt;
     &lt;/POS&gt;
     &lt;AvailRequestSegments&gt;
        &lt;AvailRequestSegment ResponseType=&quot;DailyRateList&quot;&gt;&lt;!-- request type --&gt;
           &lt;HotelSearchCriteria AvailableOnlyIndicator=&quot;false&quot;&gt;
              &lt;Criterion&gt;
                 &lt;HotelRef HotelCode=&quot;97593&quot;/&gt;&lt;!-- iHotelierID --&gt;
                 &lt;StayDateRange Start=&quot;2016-02-08&quot; End=&quot;2016-02-15&quot;/&gt;
                 &lt;RoomStayCandidates&gt;
                    &lt;RoomStayCandidate Quantity=&quot;1&quot;&gt;
                       &lt;GuestCounts&gt;
                          &lt;GuestCount AgeQualifyingCode=&quot;10&quot; Count=&quot;1&quot;/&gt;&lt;!-- Adult --&gt;
                          &lt;GuestCount AgeQualifyingCode=&quot;8&quot; Count=&quot;0&quot;/&gt;&lt;!-- Child --&gt;
                          &lt;GuestCount AgeQualifyingCode=&quot;7&quot; Count=&quot;0&quot;/&gt;&lt;!-- Infant --&gt;
                       &lt;/GuestCounts&gt;
                    &lt;/RoomStayCandidate&gt;
                 &lt;/RoomStayCandidates&gt;
              &lt;/Criterion&gt;
           &lt;/HotelSearchCriteria&gt;
        &lt;/AvailRequestSegment&gt;
     &lt;/AvailRequestSegments&gt;
  &lt;/OTA_HotelAvailRQ&gt;
  &lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
  EOT;
  
     $body = new SoapVar($xml,XSD_ANYXML);
  
  #- Calling the service method
     $result = $client-&gt;serviceRequest($body);
  
  
  #- Showing the request and response
     echo '&lt;pre&gt;', htmlentities($client-&gt;__getLastRequest()), '&lt;/pre&gt;';
     echo &quot;&lt;br&gt; --------response---------&lt;br&gt;&quot;;
     echo '&lt;pre&gt;', htmlentities($client-&gt;__getLastResponse()), '&lt;/pre&gt;';
  </code></pre>
  <p>and i'm getting this error</p>
  <pre><code>Fatal error: Uncaught SoapFault exception: [soapenv:Client.2000] Mandatory values missing in the Message Header...
  </code></pre>
  <p>Followed <a href="http://www.herongyang.com/WSDL/PHP-SOAP-Call-XML-Document-Based-Web-Service.html" rel="nofollow noreferrer">this</a> tutorial. What I'm doing wrong?</p>
  <p>If this method is wrong, how do I create soap header and body for the above XML request?</p>