Stuck at the start (PHP and WSDL) - Answered but more Qs

Forum for users and developers of Bullhorn's Webservices API suite

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
bluecube
User
Posts: 4
Joined: Thu Oct 20, 2011 7:38 am

Stuck at the start (PHP and WSDL) - Answered but more Qs

Post by bluecube » Thu Oct 20, 2011 7:47 am

Hi guys,

Just started a project that needs to consume the jobs from Bullhorn and have been given the client's username, password and apiKey.

The site will be in PHP so I am using nusoap to load in and parse the WSDL:

Code: Select all

$url = 'https://api.bullhornstaffing.com/webservices-1.1/?wsdl';
$wsdl = $url;

$BHclient = new nusoap_client($wsdl,'wsdl','','','','');


//$BHclient->setDebugLevel(0);

$result = $BHclient->call('startSession', array(
'username'=>$username,
'password'=>$password,
'apiKey'=>$apiKey,
));

echo '<pre>';
print_r($result);
echo '</pre>';
The response is:

Code: Select all

Array
(
    [faultcode] => S:Server
    [faultstring] => Invalid username and/or password.
    [detail] => Array
        (
            [exception] => Array
                (
                    [message] => Invalid username and/or password.
                    [stackTrace] => Array
                        (
                            [frame] => Array
                                (
                                    [0] => Array
etc

To me this would suggest the details I have been provided are incorrect. Unless there are any other situations that would return such a response such as no jobs to respond with.

In some examples I have read through the username is 'api.CLIENT_NAME' and others have 'CLIENT_NAME.api'. I was supplied the username as CLIENT_NAME.api.

Any help, pointers or advice would be much appreciated.

Regards,
Robert
Last edited by bluecube on Mon Oct 24, 2011 4:58 am, edited 1 time in total.

k.pham
User
Posts: 21
Joined: Thu Jun 24, 2010 5:13 pm

Re: Stuck at the start (PHP and WSDL)

Post by k.pham » Fri Oct 21, 2011 12:18 pm

How about this?
$params = array('trace' => 1,
'soap_version' => SOAP_1_1);
$BHclient = new SoapClient("https://api.bullhornstaffing.com/webser ... l",$params);

// To run this code, you will need a valid username, password, and API key.
$username = "";
$password = "";
$apiKey = "";

// Start a new session
$session_request = new stdClass();
$session_request->username = $username;
$session_request->password = $password;
$session_request->apiKey = $apiKey;
$API_session = $BHclient->startSession($session_request);
$API_currentSession = $API_session->return;

bluecube
User
Posts: 4
Joined: Thu Oct 20, 2011 7:38 am

Re: Stuck at the start (PHP and WSDL)

Post by bluecube » Mon Oct 24, 2011 4:57 am

Hi k.phram,

Thanks for replying. I am actually using nusoap as SoapClient is not too reliable (for me anyway and is in different states on different servers I use).

I actually got it working and returning a session value. It turned out someone provided incorrect username and password credentials.

Anyway, I ran the following query:

Code: Select all

$result = $BHclient->call('query', array(
            'session' => $api_session,
            'query' => array(
                'alias' => 'top_10_jobs',
                'entityName' => 'JobOrder',
                'maxResults' => 5,
                'orderBys' => 'dateAdded DESC',
                'where' => 'isOpen = 1'
            )
        ));
which returned an array of Job IDs. My next question is how do I retrieve the data for each job? Is that a separate call for each job (ie loop through array) or can I get all the data in 1 go?

Regards,
Robert

k.pham
User
Posts: 21
Joined: Thu Jun 24, 2010 5:13 pm

Re: Stuck at the start (PHP and WSDL) - Answered but more Qs

Post by k.pham » Thu Oct 27, 2011 2:00 pm

Once you get the IDs, use findMultiple to retrieve all the data in 1 call.

A sample find_multiple request looks like this:
$API_request_find_multiple_operation = array(
'session' => $API_currentSession,
'entityName' =>'ClientContact',
'ids' => $id1
'ids' => $id2
'ids' => $id3
);

Post Reply