title: Soap to consume web service : Encoding: object has no 'any' property
body: <p>I have this WSDL <a href="http://testxml.e-tsw.com/AffiliateService/AffiliateService.svc?Wsdl" rel="nofollow noreferrer">http://testxml.e-tsw.com/AffiliateService/AffiliateService.svc?Wsdl</a></p>
  
  <p>I am trying to use SoapClient to send a request to the Book method with the following code:</p>
  
  <pre><code>    &lt;?php
  
  $xml = '&lt;Request Type="Reservation" Version="1.0"&gt;
      &lt;affiliateid&gt;AF-TVOD&lt;/affiliateid&gt;
      &lt;language&gt;esp&lt;/language&gt;
      &lt;currency&gt;PE&lt;/currency&gt;
      &lt;uid&gt;m2r32b14es10socxtxs4y4ht&lt;/uid&gt;
      &lt;ip&gt;201.147.113.232&lt;/ip&gt;
      &lt;firstname&gt;prueba&lt;/firstname&gt;
      &lt;lastname&gt;prueba&lt;/lastname&gt;
      &lt;emailaddress&gt;prueba@bestday.com&lt;/emailaddress&gt;
      &lt;country&gt;MX&lt;/country&gt;
      &lt;address&gt;bonampak 4&lt;/address&gt;
      &lt;city&gt;cancun&lt;/city&gt;
      &lt;state&gt;QROO&lt;/state&gt;
      &lt;zip&gt;77500&lt;/zip&gt;
      &lt;total&gt;12346.51&lt;/total&gt;
      &lt;naturalperson&gt;
      &lt;gender&gt;&lt;/gender&gt;
      &lt;nationality&gt;&lt;/nationality&gt;
      &lt;number&gt;&lt;/number&gt;
      &lt;type&gt;&lt;/type&gt;
      &lt;/naturalperson&gt;
      &lt;legalperson&gt;
      &lt;businessname&gt;&lt;/businessname&gt;
      &lt;number&gt;&lt;/number&gt;
      &lt;type&gt;&lt;/type&gt;
      &lt;/legalperson&gt;
      &lt;phones&gt;
      &lt;phone&gt;
      &lt;type&gt;2&lt;/type&gt;
      &lt;number&gt;9981454221&lt;/number&gt;
      &lt;/phone&gt;
      &lt;/phones&gt;
      &lt;hotels&gt;
      &lt;hotel&gt;
      &lt;hotelid&gt;100&lt;/hotelid&gt;
      &lt;roomtype&gt;SUPOV&lt;/roomtype&gt;
      &lt;mealplan&gt;EP&lt;/mealplan&gt;
      &lt;datearrival&gt;20141113&lt;/datearrival&gt;
      &lt;datedeparture&gt;20141115&lt;/datedeparture&gt;
      &lt;couponid&gt;&lt;/couponid&gt;
      &lt;marketid&gt;INTER&lt;/marketid&gt;
      &lt;contractid&gt;2&lt;/contractid&gt;
      &lt;dutypercent&gt;0&lt;/dutypercent&gt;
      &lt;rooms&gt;
      &lt;room&gt;
      &lt;amount&gt;985.34&lt;/amount&gt;
      &lt;status&gt;AV&lt;/status&gt;
      &lt;ratekey&gt;90cba867-f916-4fb9-8cb4-ec925ded0fb3&lt;/ratekey&gt;
      &lt;adults&gt;1&lt;/adults&gt;
      &lt;kids&gt;1&lt;/kids&gt;
      &lt;k1a&gt;5&lt;/k1a&gt;
      &lt;/room&gt;
      &lt;/rooms&gt;
      &lt;/hotel&gt;
      &lt;/hotels&gt;
      &lt;flights&gt;
      &lt;flight&gt;
      &lt;quoteid&gt;1885e28d-5198-4dd5-92e6-6cee14a66b1b&lt;/quoteid&gt;
      &lt;ratekey&gt;bc1b40db-b0fb-40ff-92b3-6b7cde0d8685&lt;/ratekey&gt;
      &lt;passengers&gt;
      &lt;passenger&gt;
      &lt;isadult&gt;Y&lt;/isadult&gt;
      &lt;agechild&gt;&lt;/agechild&gt;
      &lt;firstname&gt;Prueba&lt;/firstname&gt;
      &lt;lastname&gt;Prueba&lt;/lastname&gt;
      &lt;daybirthday&gt;05&lt;/daybirthday&gt;
      &lt;monthbirthday&gt;06&lt;/monthbirthday&gt;
      &lt;yearbirthday&gt;1905&lt;/yearbirthday&gt;
      &lt;numberfrecuent&gt;&lt;/numberfrecuent&gt;
      &lt;idfrecuent&gt;&lt;/idfrecuent&gt;
      &lt;naturalperson&gt;
      &lt;type&gt;&lt;/type&gt;
      &lt;number&gt;&lt;/number&gt;
      &lt;/naturalperson&gt;
      &lt;/passenger&gt;
      &lt;/passengers&gt;
      &lt;contacts&gt;
      &lt;contact&gt;
      &lt;firstname&gt;Prueba&lt;/firstname&gt;
      &lt;lastname&gt;Prueba&lt;/lastname&gt;
      &lt;email&gt;&lt;/email&gt;
      &lt;phones&gt;
      &lt;phone&gt;
      &lt;type&gt;1&lt;/type&gt;
      &lt;number&gt;(+52)654654646&lt;/number&gt;
      &lt;/phone&gt;
      &lt;/phones&gt;
      &lt;/contact&gt;
      &lt;/contacts&gt;
      &lt;/flight&gt;
      &lt;/flights&gt;
      &lt;shuttles&gt;
      &lt;shuttle&gt;
      &lt;shuttleid&gt;599&lt;/shuttleid&gt;
      &lt;shuttletype&gt;R&lt;/shuttletype&gt;
      &lt;adults&gt;2&lt;/adults&gt;
      &lt;kids&gt;0&lt;/kids&gt;
      &lt;airportarrival&gt;Aeropuerto Internacional de Cancun &lt;/airportarrival&gt;
      &lt;airlinearrival&gt;AC&lt;/airlinearrival&gt;
      &lt;datearrival&gt;20140501&lt;/datearrival&gt;
      &lt;hourarrival&gt;18:00&lt;/hourarrival&gt;
      &lt;flightarrival&gt;123&lt;/flightarrival&gt;
      &lt;airlinedeparture&gt;PU&lt;/airlinedeparture&gt;
      &lt;datedeparture&gt;20140502&lt;/datedeparture&gt;
      &lt;hourdeparture&gt;04:00&lt;/hourdeparture&gt;
      &lt;flightdeparture&gt;456&lt;/flightdeparture&gt;
      &lt;hotelid&gt;640&lt;/hotelid&gt;
      &lt;amount&gt;724.8&lt;/amount&gt;
      &lt;/shuttle&gt;
      &lt;/shuttles&gt;
      &lt;insurances&gt;
      &lt;insurance&gt;
      &lt;insuranceid&gt;12&lt;/insuranceid&gt;
      &lt;adults&gt;2&lt;/adults&gt;
      &lt;children&gt;0&lt;/children&gt;
      &lt;amount&gt;105.1049&lt;/amount&gt;
      &lt;ratekey&gt;4f2b132f-6663-427a-aa75-61c5d8e37635&lt;/ratekey&gt;
      &lt;/insurance&gt;
      &lt;/insurances&gt;
      &lt;cars&gt;
      &lt;car&gt;
      &lt;agency&gt;2&lt;/agency&gt;
      &lt;sipp&gt;AR133&lt;/sipp&gt;
      &lt;amount&gt;869.76&lt;/amount&gt;
      &lt;brancharrival&gt;139&lt;/brancharrival&gt;
      &lt;airportarrival&gt;CUN&lt;/airportarrival&gt;
      &lt;datearrival&gt;20140501&lt;/datearrival&gt;
      &lt;hourarrival&gt;12:00&lt;/hourarrival&gt;
      &lt;branchdeparture&gt;139&lt;/branchdeparture&gt;
      &lt;airportdeparture&gt;CUN&lt;/airportdeparture&gt;
      &lt;datedeparture&gt;20140502&lt;/datedeparture&gt;
      &lt;hourdeparture&gt;12:00&lt;/hourdeparture&gt;
      &lt;/car&gt;
      &lt;/cars&gt;
      &lt;tours&gt;
      &lt;tour&gt;
      &lt;tourid&gt;413&lt;/tourid&gt;
      &lt;serviceid&gt;1&lt;/serviceid&gt;
      &lt;cityid&gt;NOCIUDAD&lt;/cityid&gt;
      &lt;adults&gt;2&lt;/adults&gt;
      &lt;kids&gt;0&lt;/kids&gt;
      &lt;datetour&gt;20140711&lt;/datetour&gt;
      &lt;hotelname&gt;Cancun Clipper Club, Cancun Zona Hotelera Punta Cancun, Mexico&lt;/hotelname&gt;
      &lt;timetour&gt;00:00&lt;/timetour&gt;
      &lt;amount&gt;2035.62&lt;/amount&gt;
      &lt;dutypercent&gt;0&lt;/dutypercent&gt;
      &lt;/tour&gt;
      &lt;/tours&gt;
      &lt;payments&gt;
      &lt;cardpayment&gt;
      &lt;type&gt;86&lt;/type&gt;
      &lt;bank&gt;BC3&lt;/bank&gt;
      &lt;number&gt;XXXXXXXXXXXXXX&lt;/number&gt;
      &lt;securitycode&gt;1212&lt;/securitycode&gt;
      &lt;expirationmonth&gt;03&lt;/expirationmonth&gt;
      &lt;expirationyear&gt;2018&lt;/expirationyear&gt;
      &lt;holdername&gt;prueba prueba&lt;/holdername&gt;
      &lt;address&gt;bonampak 4&lt;/address&gt;
      &lt;city&gt;cancun&lt;/city&gt;
      &lt;state&gt;QROO&lt;/state&gt;
      &lt;country&gt;MX&lt;/country&gt;
      &lt;zip&gt;77500&lt;/zip&gt;
      &lt;amount&gt;12346.51&lt;/amount&gt;
      &lt;/cardpayment&gt;
      &lt;/payments&gt;
      &lt;/Request&gt;';
  
  
  $funcion = "Book";    
  ini_set('soap.wsdl_cache_enabled', 0);    
  $wsdl = 'http://testxml.e-tsw.com/AffiliateService/AffiliateService.svc?Wsdl';    
  $client = new SoapClient($wsdl);    
  $xml_reserva = simplexml_load_string($xml, NULL, LIBXML_NOCDATA);
  try {
      $respuesta = $client-&gt;__soapCall($funcion, array('Parameters' =&gt; $xml_reserva));
      } catch (SoapFault $exception) {
          echo $exception-&gt;getMessage();
  
      }
  ?&gt;
  </code></pre>
  
  <p>I get the following error:
  <strong>SOAP-ERROR: Encoding: object has no 'any' property</strong></p>
  
  <p>Important info: If I try with Gethotels and the following xml and "funcion" it works, but when I try to "Book" doesn't.</p>
  
  <pre><code>$xml = '&lt;Request Version="1.0" encoding="utf-8"&gt;
  &lt;d&gt;2&lt;/d&gt;
  &lt;a&gt;AF-TVOD&lt;/a&gt;
  &lt;l&gt;esp&lt;/l&gt;
  &lt;/Request&gt;';
  $funcion = "GetHotels";
  </code></pre>