Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

When consuming the EngageIP WSDL file using PHP you will use the available SoapClient PHP class to configure your authentication headers as well as execute your various SOAP API calls.

Below you will find some sample code that provides a utility function to convert a SOAP array results to mapped PHP arrays, as well as a sample initial configuration for the supplied EngageIP WSDL file and SOAP authentication headers.  This sample code calls the GetUserDetail EngageIP SOAP method and echo's the results.

<!--?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.

 <wsdl:port name="EngageIP_x0020_Web_x0020_Services_x0020_APISoap" binding="tns:EngageIP_x0020_Web_x0020_Services_x0020_APISoap">
 <soap:address location="https://yourdomain/adminportal/webservice.asmx" />
 </wsdl:port>
 <wsdl:port name="EngageIP_x0020_Web_x0020_Services_x0020_APISoap12" binding="tns:EngageIP_x0020_Web_x0020_Services_x0020_APISoap12">
 <soap12:address location="https://yourdomain/adminportal/webservice.asmx" />
 </wsdl:port>

  • No labels