public function CreateOrUpdateClient($campaignId, $properties, $fileNumber = null) { if (isset($this->DebugPage)) { $this->Debug_Log_Updated_Fields(array_keys($properties)); } $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($campaignId, XSD_STRING, null, null, 'ns1:campaignId'); // clientProperties $clientProperties = new ArrayObject(); $propertyList = new ArrayObject(); if (isset($fileNumber) && $fileNumber) { $properties['LeadNumber'] = $fileNumber; } // Encryption Storage System $i = 0; foreach ($properties as $propertyName => $propertyValue) { @($clientProperties[$i]->{'ns1:Name'} = $propertyName); @($clientProperties[$i]->{'ns1:Value'} = $propertyValue); $propertyList->append(new SoapVar($clientProperties[$i], SOAP_ENC_OBJECT, NULL, NULL, 'ns1:ClientProperty')); $i++; } // array('FirstName', 'LastName', 'EmailAddress', 'HomeNumber'); $parms[] = new SoapVar($propertyList, SOAP_ENC_OBJECT, NULL, NULL, 'ns1:propertyList'); $soap = new SoapClient($soap_url, $this->GetSoapOptions()); try { $call = $soap->CreateOrUpdateClient(new SoapVar($parms, SOAP_ENC_OBJECT)); //if this was success! return it. if (isset($call->CreateOrUpdateClientResult)) { if (substr($call->CreateOrUpdateClientResult, 0, 7) == 'SUCCESS') { if (substr($call->CreateOrUpdateClientResult, 8)) { return substr($call->CreateOrUpdateClientResult, 8); } else { return true; } } else { $this->error = $call->CreateOrUpdateClientResult; return false; } } return false; } catch (SoapFault $fault) { echo "<br/><br/><font color='red'>"; print "Returned the following ERROR: " . $fault->faultcode . "-" . $fault->faultstring; echo "</font>"; return false; //error } }