public function GetClient($fileNumber, $properties = array()) { $soap_url = $this->GetClientWSDL(); $parms = array(); $parms[] = new SoapVar($this->userName, XSD_STRING, null, null, 'ns1:userName'); $parms[] = new SoapVar($this->password, XSD_STRING, null, null, 'ns1:password'); $parms[] = new SoapVar($fileNumber, XSD_STRING, null, null, 'ns1:fileNumber'); ## if they don't request this, request it anyway. if (!in_array('completed_steps_bitwise', $properties)) { array_push($properties, 'completed_steps_bitwise'); } if (!in_array('cart_status', $properties)) { array_push($properties, 'cart_status'); } if (!in_array('cart_items', $properties)) { array_push($properties, 'cart_items'); } if (!in_array('cart_id', $properties)) { array_push($properties, 'cart_id'); } if (!in_array('cart_steps_required', $properties)) { array_push($properties, 'cart_steps_required'); } if (!in_array('cart_order_time', $properties)) { array_push($properties, 'cart_order_time'); } if (!in_array('products_already_purchased', $properties)) { array_push($properties, 'products_already_purchased'); } // prepare the properties $clientProperties = array(); $i = 0; foreach ($properties as $propertyName) { $clientProperties[$i] = new SoapVar($propertyName, XSD_STRING, null, null, 'ns1:string'); $i++; } $parms[] = new SoapVar($clientProperties, SOAP_ENC_OBJECT, NULL, NULL, 'ns1:propertyNameList'); $soap = new SoapClient($soap_url, $this->GetSoapOptions()); try { $call = $soap->GetClient(new SoapVar($parms, SOAP_ENC_OBJECT)); if (isset($call->GetClientResult)) { //Lets reorganize the Parms. // Translate the ClientStatus so ClientStatus->{WorkName}= {STATUS} if (isset($call->GetClientResult->CurrentStatus->ClientStatus)) { $call->GetClientResult->Status = new stdClass(); if (!is_array($call->GetClientResult->CurrentStatus->ClientStatus)) { $call->GetClientResult->CurrentStatus->ClientStatus = array($call->GetClientResult->CurrentStatus->ClientStatus); } foreach ($call->GetClientResult->CurrentStatus->ClientStatus as $cin) { if (isset($cin->WorkflowName) && isset($cin->Name)) { $call->GetClientResult->Status->{$cin->WorkflowName} = $cin->Name; } } } $Properties = $call->GetClientResult->Properties->ClientProperty; if (!is_array($Properties)) { $Properties = array($Properties); } $call->GetClientResult->TProperties = new stdClass(); foreach ($Properties as $prop) { if (isset($prop->Name) && isset($prop->Value)) { $call->GetClientResult->TProperties->{$prop->Name} = @$prop->Value; } } if (!isset($call->GetClientResult->TProperties->completed_steps_bitwise)) { $call->GetClientResult->TProperties->completed_steps_bitwise = 0; } $call->GetClientResult->TProperties->completed_steps_bitwise = intval($call->GetClientResult->TProperties->completed_steps_bitwise); //our defaults $call->GetClientResult->CompletedStep = 0; $call->GetClientResult->NextStep = 1; for ($stepnumber = 1; $stepnumber <= 7; $stepnumber++) { $constant = 'step' . $stepnumber; if (defined($constant)) { $constant_value = constant($constant); if ($call->GetClientResult->TProperties->completed_steps_bitwise & $constant_value) { $call->GetClientResult->CompletedStep = $stepnumber; $call->GetClientResult->NextStep = $stepnumber + 1; $call->GetClientResult->{'Completed_Step_' . $stepnumber} = true; } else { $call->GetClientResult->{'Completed_Step_' . $stepnumber} = false; } } } return $call->GetClientResult; } return false; } catch (SoapFault $fault) { return false; } }