The SoapClient class provides a client for SOAP servers. It creates an object according to the information in the
WSDL document. The SoapClient object has methods that correspond to the methods of the web service. You can
then interact with the web service as though it were a local PHP class. For the details about this class,
see http://php.net/manual/en/class.soapclient.php .
To verify that the soap client is installed, run a script with <?php phpinfo() ?>. The output includes "Soap Client:
enabled".
In this section, you instantiate a SoapClient object.
Instantiate the SoapClient object, passing in the URL for the Bullhorn SOAP API, and parameters to set trace on
and to specify the SOAP version. The trace output will be helpful for debugging.
$params = array(
'trace' => 1,
'soap_version' => SOAP_1_1
);
$BHclient = new SoapClient("https://api.bullhornstaffing.com/webservices-
1.1/?wsdl",$params);
Note: At the time of publication, the latest version of the Bullhorn SOAP API is version 1.1.
Getting started
To develop applications with the Bullhorn web services API, you require a username, password, and API key. If you
don't want to use your own, contact Bullhorn support to provide an API user account.
Note: Developers who work directly for Bullhorn customers get API access by contacting Bullhorn Support. After the
APIs are enabled for a Bullhorn client, a client administrator can generate a customer-specific API key by going to
Tools > BH Connect > Web Services API. If a key does not already exist, , click Add Account to create one.
Understanding how the Bullhorn SOAP API works
The sample PHP client application shows the required steps for creating a session between the client application and
the Bullhorn system, and demonstrates the invocation and subsequent handling of some API calls
You program the sample application to perform the following tasks:
• Create a session to the Bullhorn web service by using your credentials.
• Build a basic query using the dtoQuery class.
• Retrieve a single instance of the Candidate DTO.
• Retrieve multiple instances of the Candidate DTO.
• Publish the results on the console.
Creating a session
You must create a session for all calls to the Bullhorn SOAP API. To create a session to the Bullhorn system in the
web application, you require a username, password, and API key. In this section, you define the authentication
mechanism for access, and create a session to the Bullhorn service.
1. In the GettingStartedWithWebServices.php file, define three variables. Bullhorn support provides these
values, as described in the Getting Started section.
$username = "yourusername";
$password = "yourpassword";
$apiKey = "yourapikey";
2. Create an empty class and assign the username, password, and apiKey properties to this class.
3. $session_request = new stdClass;
4. $session_request->username = $username;
5. $session_request->password = $password;
$session_request->apiKey = $apiKey;