Error Saving candidateReference Entity through API

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
JSW
User
Posts: 9
Joined: Fri Jan 28, 2011 5:37 pm

Error Saving candidateReference Entity through API

Post by JSW » Mon May 02, 2011 9:58 pm

I am getting an error when saving a candidateReference entity using the api. I have followed the same logic that I used to successfully save a Candidate entity, but I get the following error.
javax.xml.bind.UnmarshalException - with linked exception: [javax.xml.bind.UnmarshalException: Unable to create an instance of com.bullhorn.entity.AbstractDto - with linked exception: [java.lang.InstantiationException]]


I am able to retrieve a candidateReference DTO with the following code

Code: Select all

$candidate_reference_id = xxx;
$SOAP_id = new SoapVar($candidate_reference_id,XSD_INTEGER,'int','http://www.w3.org/2001/XMLSchema');				
$bh_request = new stdClass;
$bh_request->session = $bh_current_session;
$bh_request->entityName = 'CandidateReference';
$bh_request->id = $SOAP_id;
			
$bh_response = $bh_client->find($bh_request);			
			
$candidateReferenceDTO = $bh_response->return->dto;
Then, I modify the first name of the reference.

Code: Select all

$candidateReferenceDTO->referenceFirstName = 'newFirstName';
The error happens when I try to save the modified DTO to Bullhorn with the following code

Code: Select all

// Convert DTO to something the api will understand
$SOAP_candidateReference = new SoapVar($dto,XSD_ANYTYPE,'candidateReferenceDto','http://candidateReference.entity.bullhorn.com/');

// Create the request
$bh_request = new stdClass;
$bh_request->session = $bh_current_session;
$bh_request->dto = $SOAP_candidateReference;

try {
	$bh_response = $bh_client->save($bh_request);			
}
catch (SoapFault $fault){
	die($fault->faultstring); 
	return false;
}
print_r($bh_response);
I suspect that the problem lies with the creation of the SoapVar and that either 'candidateReferenceDto' or 'http://candidateReference.entity.bullhorn.com/' is incorrect, but I have no idea what else they might be.

Thanks for your help,
Julie

jdonnelly
User
Posts: 192
Joined: Wed Feb 09, 2011 4:57 pm

Re: Error Saving candidateReference Entity through API

Post by jdonnelly » Tue May 03, 2011 1:23 pm

Hello Julie,

Can you provide your corporation id and the id of the candidate reference that you are testing with? The SoapVar definition looks different from similar dto saves that I have done with PHP in the past (I don't have a candidate reference save snippet handy). I would expect the definition to have a different object encoding and type - but I am not completely sure if this is exactly the issue that you are seeing, so I would like to reproduce the issue on my side (unless you are able to make the change and that change addresses your issue).

Code: Select all

new SoapVar($dto, SOAP_ENC_OBJECT, "candidateReference","http://candidateReference.entity.bullhorn.com/"); 
Please let me know if you have any questions or if anything is not clear.

Thanks,
Jon Donnelly
Technical Support Engineer
Developer Forum Admin
B U L L H O R N
support@bullhorn.com

JSW
User
Posts: 9
Joined: Fri Jan 28, 2011 5:37 pm

Re: Error Saving candidateReference Entity through API

Post by JSW » Tue May 03, 2011 1:53 pm

Hi Jon,

I tried the suggested encoding type and got the same error.

I'm not 100% sure, but I think the corporationId is 2174. - This is the ownerCorporationID that I get when viewing a candidate.
The candidateId is 35077.
The candidateReference that I'm trying to update is 8250.

Thanks for your help.

Julie

JSW
User
Posts: 9
Joined: Fri Jan 28, 2011 5:37 pm

Re: Error Saving candidateReference Entity through API

Post by JSW » Thu May 05, 2011 12:54 pm

Hi Jon,

I'm just writing to see if you have made any headway on this, or if you need anything else from me.

Thanks,
Julie

jdonnelly
User
Posts: 192
Joined: Wed Feb 09, 2011 4:57 pm

Re: Error Saving candidateReference Entity through API

Post by jdonnelly » Mon May 09, 2011 9:23 am

Hello Julie,

I think I found the issue... The type name needs to be the complex type name from the WSDL and the URL needs to be the namespace for the object. So, the candidate reference dto object should be defined as follows.

Code: Select all

$SOAP_candidateReference  = new SoapVar($candidateReference, SOAP_ENC_OBJECT, "candidateReferenceDto","http://candidate.entity.bullhorn.com/");
Please let me know if you see any further issues.

Thanks,
Jon Donnelly
Technical Support Engineer
Developer Forum Admin
B U L L H O R N
support@bullhorn.com

Post Reply