...
Code Block |
---|
<!--?php --> // Convert a returned object to an array function objectToArray( $object ) { if(!is_object($object) && !is_array($object)) { return $object; } if(is_object($object)){ $object = get_object_vars($object); } // Otherwise return array_map('objectToArray', $object); } try { // Load the downloaded EngageIP WSDL file $soapClient = new SoapClient("EngageIP.wsdl",array('soap_version'=>SOAP_1_2, 'trace'=>1)); // Prepare SoapHeader parameters $sh_param = array( 'Username' => 'admin', 'Password' => 'admin'); $headers = new SoapHeader('Logisense_EngageIP', 'AuthHeader', $sh_param); // Prepare Soap Client $soapClient->__setSoapHeaders(array($headers)); $results = $soapClient->GetUserDetail(array("username"=>"admin")); $array = objectToArray($results); // Display our returned results echo 'Username = '. $array['GetUserDetailResult']['Name'] . ''; echo 'Password = '. $array['GetUserDetailResult']['Password']. ''; echo 'Status Type = '. $array['GetUserDetailResult']['UserStatusType']. ''; } catch (Exception $e) { echo " <h2>Exception Error!</h2> "; echo $e->getMessage(); } ?> |
Updating Your SOAP Address
After downloading your WSDL file be sure to open up the WSDL document in your favorite editor and adjust the target address of the SOAP interface to your server's address. This can be accomplished by searching for the "soap:address" element to configure the URL. Be sure to use an HTTPS secured address to ensure that authentication headers are encrypted.
...