Authenticate SP Method
Warranty Disclaimer
The Sample Code provided is supplied for demonstration purposes only. Please do not use the Sample Code in a production or public environment, it is for reference only. The Sample code is provided “as is,” without warranty of any kind. GBG offers no technical support for the Sample Code and is under no obligation to provide updates, fixes or additional releases to the Sample Code.
PHP Examples
Authenticate SP (Single Profile)
_____________________________________PHP__________________________________________ <?php date_default_timezone_set('Europe/London'); class WsseAuthHeader extends SoapHeader { private $wss_ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'; function __construct($user, $pass, $ns = null) { if ($ns) { $this->wss_ns = $ns; } $auth = new stdClass(); $auth->Username = new SoapVar($user, XSD_STRING, NULL, $this->wss_ns, NULL, $this->wss_ns); $auth->Password = new SoapVar($pass, XSD_STRING, NULL, $this->wss_ns, NULL, $this->wss_ns); $username_token = new stdClass(); $username_token->UsernameToken = new SoapVar($auth, SOAP_ENC_OBJECT, NULL, $this->wss_ns, 'UsernameToken', $this->wss_ns); $security_sv = new SoapVar( new SoapVar($username_token, SOAP_ENC_OBJECT, NULL, $this->wss_ns, 'UsernameToken', $this->wss_ns), SOAP_ENC_OBJECT, NULL, $this->wss_ns, 'Security', $this->wss_ns); parent::__construct($this->wss_ns, 'Security', $security_sv, true); } } $username = "Your Username"; $password = "Your Password"; $wsse_header = new WsseAuthHeader($username, $password); $options = array( 'soap_version' => SOAP_1_1, 'exceptions' => true, 'trace' => 1, 'wdsl_local_copy' => true ); // This is currently linked to the pilot or test site. $wsdl = 'https://pilot.id3global.com/ID3gWS/ID3global.svc?wsdl'; $soapClient = new SoapClient($wsdl, $options); $soapClient->__setSoapHeaders(array($wsse_header)); $objParam = new stdClass(); $objParam ->ProfileIDVersion = new stdClass(); $objParam ->ProfileIDVersion ->ID ='9df6afe9-34e2-45da-a1eb-41aa03931dac'; // This can be found via the admin portal of id3 global. $objParam ->ProfileIDVersion ->Version =0; // Setting this to zero will by default call the latest active version of the profile$objParam ->CustomerReference particular customer $objParam ->InputData = new stdClass(); $objParam ->InputData->Personal = new stdClass(); $objParam ->InputData->Personal->PersonalDetails = new stdClass(); $objParam ->InputData->Personal->PersonalDetails->Title $objParam ->InputData->Personal->PersonalDetails->Forename $objParam ->InputData->Personal->PersonalDetails->MiddleName $objParam ->InputData->Personal->PersonalDetails->Surname $objParam ->InputData->Personal->PersonalDetails->Gender $objParam ->InputData->Personal->PersonalDetails->DOBDay $objParam ->InputData->Personal->PersonalDetails->DOBMonth $objParam ->InputData->Personal->PersonalDetails->DOBYear $objParam ->InputData->Addresses = new stdClass(); $objParam ->InputData->Addresses->CurrentAddress = new stdClass(); $objParam ->InputData->Addresses->CurrentAddress->Country $objParam ->InputData->Addresses->CurrentAddress->Street $objParam ->InputData->Addresses->CurrentAddress->City $objParam ->InputData->Addresses->CurrentAddress->ZipPostcode $objParam ->InputData->Addresses->CurrentAddress->Building if (is_soap_fault($soapClient)) { throw new Exception(" {$soapClient->faultcode}: {$soapClient->faultstring} "); } $objRet = null; try { $objRet = $soapClient->AuthenticateSP($objParam); echo '<pre>'; print"Decision Band :".($objRet->AuthenticateSPResult->BandText)."<br>"; echo '</pre>';} catch (Exception $e) { echo "<pre>"; print_r($e); echo "</pre>"; } if (is_soap_fault($objRet)) { throw new Expception(" {$objRet->faultcode}: {$objRet->faultstring} "); } ?> _____________________________________PHP_______________________________________