To send requests containing ComplexTypes we needed to create stdClass objects for each ComplexType. If the ComplexType has an attribute we created a class with all the fields and attributes as members and added this class to the classmap with the correct type name from the wsdl. For example:
//to create soap client
$soapClient = new SoapClient("<your wsdl url>",
array('classmap' => array('RoomType' => 'RoomType'), 'trace' => 1));
//creating request object using custom class since there is an attribute needed
class RoomType {
//attribute
var $code;
var $name;
}
$RoomType = new RoomType();
$RoomType->code = $code;
//plain stdClass is ok since no attributes defined
$LRoomCode = new stdClass();
$LRoomCode->RoomType = new SoapVar($RoomType, SOAP_ENC_OBJECT, "RoomType", "<your namespace url from wsdl>");
//define a basic class object since attributes are not needed for this complex type
$RateAvailabilityReq = new stdClass();
$RateAvailabilityReq->LRoomCode = new SoapVar($LRoomCode, SOAP_ENC_OBJECT, "ArrayOfRoomType", "<your namespace url>");
$RateAvailabilityReq->idB2BHotel = $idB2BHotel;
$RateAvailabilityReq->idProduct = $idProduct;
$RateAvailabilityReq->lenght = $lenght;
$RateAvailabilityReq->nameDistributor = $nameDistributor;
$RateAvailabilityReq->password = $password;
$RateAvailabilityReq->propertyCode = $propertyCode;
$RateAvailabilityReq->startDate = $startDate;
$RateAvailabilityReq->userName = $userName;
$RateUpdateReqType = new SoapVar($RateAvailabilityReq , SOAP_ENC_OBJECT, "RateAvailabilityReq", "<your namespace url>");
$soapRequestType = new stdClass();
$soapRequestType->in0 = $RateUpdateReqType;
$getRateAvailabilityReq = new SoapVar($soapRequestType , SOAP_ENC_OBJECT, "getRateAvailability", "<your namespace url>");
$result = $soapClient->getRateAvailability($getRateAvailabilityReq);
Reading attributes from ComplexType response objects also required a custom class added to the classmap array with the attribute as a member of the class.