Can't load WSDL

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
enapoleone
User
Posts: 28
Joined: Sat Nov 17, 2012 12:06 am

Can't load WSDL

Post by enapoleone » Sat Jan 12, 2013 11:17 am

I'm following the query operation in the examples found here http://developer.bullhorn.com/Getting_S ... es_and_PHP and modifying the query to use the JobOrder entity.

I have a username, password and apiKey but I can not get past loading the wsdl.

Also trying to go to the URL for the wsdl in my browser returns a 404.

Code: Select all

$params = array(
            'trace' => 1,
            'soap_version' => SOAP_1_1
        );

$BHclient = new SoapClient('https://api.bullhornstaffing.com/webservices-2.5/?wsdl',$params);

$username = 'xxx';
$password = 'xxx';
$apiKey   = 'xxx';

$session_request = new stdClass();
$session_request->username = $username;
$session_request->password = $password;
$ression_request->apiKey   = $apiKey;

$API_session = $BHclient->startSession($session_request);
$API_currentSession = $API_session->return;

$query_array = array(
            'entityName' => 'jobOrder',
            'where'      => 'isDeleted=0',
            'parameters' => array()
        );

$SOAP_query = new SoapVar($query_array,SOAP_ENC_OBJECT,'dtoQuery','http://query.apiservice.bullhorn.com/');

$request_array = array(
            'session' => $API_currentSession,
            'query'   => $SOAP_query
        );

$SOAP_request = new SoapVar($request_array,SOAP_ENC_OBJECT,'query','http://query.apiservice.bullhorn.com/');

try{
    $query_result = $BHclient->query($SOAP_request);
} catch (SoapFault $fault) {
    echo $BHclient->__getLastResult();
    die($fault->faultstring);
}

Code: Select all

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://api.bullhornstaffing.com/webservices-1.1/?wsdl' : failed to load external entity "https://api.bullhornstaffing.com/webservices-1.1/?wsdl"
 in /path/to/htdocs/bullhorn.php:7
Stack trace:
#0 /path/to/htdocs/bullhorn.php(7): SoapClient->SoapClient('https://api.bul...', Array)
#1 {main}
  thrown in /path/to/htdocs/bullhorn.php on line 7
Can anyone see what I might be doing wrong?

Also is __getLastResult() (as per the documentation) an actual PHP method?

c.choy
User
Posts: 49
Joined: Wed Dec 31, 1969 8:00 pm

Re: Can't load WSDL

Post by c.choy » Wed Jan 23, 2013 4:35 pm

Hi,

1)
If you look at the line where you define the apiKey, you're setting it to $ression_request as opposed to session_request (the first letter is a R instead of a S as it should be)

2)
The other item is where you grab the session, you should grab it like $API_currentSession = $API_session->return->session; as opposed to just $API_currentSession = $API_session->return; Since 2.0 and later, the return provided more information than is necessary to pass for the session value.

3)
As for the catch, I usually just use something of the like:

} catch (SoapFault $fault) {
echo $fault;
die($fault->faultstring);
}

Post Reply