ParseResume Issue on API 2.0 (URGENT)

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

rkarthy
User
Posts: 39
Joined: Mon Feb 11, 2008 12:49 pm
Location: Wakefield, MA, USA

ParseResume Issue on API 2.0 (URGENT)

Post by rkarthy » Fri Oct 21, 2011 10:48 am

Hi,

I'm trying to Parse the resume using the web Service API 2.0. But it always gives the following error info. Can someone please guide me to move further?

Error Info:
response.success = false
response.diagnostics = HttpResponseCode=200, InitStatus=null, InitStatusStr=null, StellentStatus=null, StellentStatusStr=null, RexStatus=null, RexStatusStr=null

Code I'm using for parsing the resume (C#):
string fileName = Server.MapPath("App_Data") + "/" + txtFileUpload.FileName;
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
long numBytes = new FileInfo(fileName).Length;
byte[] fileData = br.ReadBytes((int)numBytes);
apiParseResumeResult response = BullHornBase.BHService.parseResume(BHSession, fileData );

Thanks in advance.

Regards,
Karthik

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

Re: ParseResume Issue on API 2.0 (URGENT)

Post by k.pham » Fri Oct 21, 2011 11:55 am

I believe you have to encode your fileData to Base64 before placing a parseResume call.
This tutorial showed you how to encode to base64:
http://arcanecode.com/2007/03/21/encodi ... se64-in-c/

rkarthy
User
Posts: 39
Joined: Mon Feb 11, 2008 12:49 pm
Location: Wakefield, MA, USA

Re: ParseResume Issue on API 2.0 (URGENT)

Post by rkarthy » Fri Oct 21, 2011 1:35 pm

Yes. But the issue is, ParseResume will accept file only in binary (byte[]) format. But when i use the Convert.ToBase64String, it'll return the result in string format. So i can't pass this base64 result on the Parseresume method. Do you have any sample code to achieve this?


Thanks,
Karthik

rkarthy
User
Posts: 39
Joined: Mon Feb 11, 2008 12:49 pm
Location: Wakefield, MA, USA

Re: ParseResume Issue on API 2.0 (URGENT)

Post by rkarthy » Mon Oct 24, 2011 9:29 am

Hi, Any one from Bullhorn support can resolve this issue?

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

Re: ParseResume Issue on API 2.0 (URGENT)

Post by k.pham » Mon Oct 24, 2011 5:04 pm

You should be able to convert the file data to a base64 String, and encode that base64 string to binary.

Code: Select all

// file data in Binary
byte[] fileData = br.ReadBytes((int)numBytes);

//convert fileData from Binary to Base64String
String Base64String = Convert.ToBase64String(fileData );

// convert the base-64 string back to a byte array
byte[] DecodedData = Convert.FromBase64String(Base64String);

//Make the API call:
apiParseResumeResult response = BullHornBase.BHService.parseResume(BHSession, DecodedData);

I found this tutorial that might be useful for you.
http://www.dijksterhuis.org/encoding-an ... 64-with-c/

rkarthy
User
Posts: 39
Joined: Mon Feb 11, 2008 12:49 pm
Location: Wakefield, MA, USA

Re: ParseResume Issue on API 2.0 (URGENT)

Post by rkarthy » Tue Oct 25, 2011 4:37 pm

Yep. I tried this already. It gave me the same error message. Also the line number 1 and 3 are basically gives the same result isn't it? Because in the line number 2 we are converting the 8-bit unsigned integer to base64 encoded string. In the line 3 we are converting the base64 encoded string to 8-bit unsigned integer.

// file data in Binary
byte[] fileData = br.ReadBytes((int)numBytes);//--------------------> 1

//convert fileData from Binary to Base64String
String Base64String = Convert.ToBase64String(fileData );//--------------------> 2

// convert the base-64 string back to a byte array
byte[] DecodedData = Convert.FromBase64String(Base64String);//--------------------> 3

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

Re: ParseResume Issue on API 2.0 (URGENT)

Post by k.pham » Wed Oct 26, 2011 3:31 pm

Hi,
My bad, I meant to ask yo to convert the Base64String to a byte array, not to decode to.
Could you try this?

Code: Select all

// file data in Binary
byte[] fileData = br.ReadBytes((int)numBytes);

//convert fileData from Binary to Base64String
String Base64String = Convert.ToBase64String(fileData );

// convert the base-64 string back to a byte array
System.Text.UTF8Encoding  encoding=new System.Text.UTF8Encoding();
byte[] toParse = encoding.GetBytes(Base64String);

//Make the API call:
apiParseResumeResult response = BullHornBase.BHService.parseResume(BHSession, toParse );


Similar sample code in Java using the same concept: File -> byte [] -> base64String -> byte[] -> api call (author: MMartin4)

Code: Select all

String sKey = session.getSession();
File myFile = new File("TestResume.docx");
FileInputStream fis = new FileInputStream(myFile);
    
long fileLength = myFile.length();
byte[] b = new byte[(int) fileLength];
fis.read(b,0,(int)fileLength);
fis.close();
		
String base64String  = MyBase64Class.encode(b);
b = base64String.getBytes();
ApiParseResumeResult parseResult = service.parseResume(sKey, b);

rkarthy
User
Posts: 39
Joined: Mon Feb 11, 2008 12:49 pm
Location: Wakefield, MA, USA

Re: ParseResume Issue on API 2.0 (URGENT)

Post by rkarthy » Thu Oct 27, 2011 10:28 am

Thanks for the Reply. When I have tried the above code still it's failing. But I'm getting some different error this time. Please find the error message below,

HttpResponseCode=200
InitStatus=0
InitStatusStr=
StellentStatus=0
StellentStatusStr=
RexStatus=-1
RexStatusStr=Rex has not been initialized

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

Re: ParseResume Issue on API 2.0 (URGENT)

Post by k.pham » Thu Oct 27, 2011 1:51 pm

Sorry I thought I posted this. Can you try with a real resume? I get this error as well if I just used a random file that doesn't make sense to the resume parser.

rkarthy
User
Posts: 39
Joined: Mon Feb 11, 2008 12:49 pm
Location: Wakefield, MA, USA

Re: ParseResume Issue on API 2.0 (URGENT)

Post by rkarthy » Fri Oct 28, 2011 9:51 am

Nope. I have tried with 3 different valid resumes. I got the same error message.

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

Re: ParseResume Issue on API 2.0 (URGENT)

Post by k.pham » Wed Nov 02, 2011 9:36 am

rkarthy,
Please find below the sample code that works for us.
Thanks,

Code: Select all

         static void log(String text){
            Console.WriteLine(text);
        }

        static void Main(string[] args){

            String path = "C:\\BobSmithTestResume.doc";

            log("Parsing resume: " + path);
            FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
            
            BinaryReader br = new BinaryReader(fs);
            
            long numBytes = new FileInfo(path).Length;
            log("numBytes: " + numBytes.ToString());
            
            byte[] fileData = br.ReadBytes((int)numBytes);

            String Base64String = Convert.ToBase64String(fileData);

            // convert the base-64 string back to a byte array
            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            byte[] toParse = encoding.GetBytes(Base64String);

            String username = "";
            String password = "";
            String apiKey = "";

            ApiService service = new ApiService();

            // Instantiate the apiSession class
            apiStartSessionResult currentSessionPackage = new apiStartSessionResult();

            // Start an API session with the authentication information
            log("Starting session...");
            currentSessionPackage = service.startSession(username, password, apiKey);
            String currentSession = currentSessionPackage.session;
            log("Session: " + currentSession);

            apiParseResumeResult myParseResumeResult = new apiParseResumeResult();

            myParseResumeResult = service.parseResume(currentSession, toParse);
            
            string diagnostic = myParseResumeResult.diagnostics;
            string myHrXML = myParseResumeResult.hrXml;

            log("Diagnostic: " + diagnostic);
            log("Hrxml: " + myHrXML);
            
        
}

rkarthy
User
Posts: 39
Joined: Mon Feb 11, 2008 12:49 pm
Location: Wakefield, MA, USA

Re: ParseResume Issue on API 2.0 (URGENT)

Post by rkarthy » Thu Nov 03, 2011 11:45 am

Yes. I checked from my side and now my existing code is working fine and returning the result without any error. But that parsed resume information was not updated on the Candidate entity fields like our legacy API. Do i have to update the hrxml result on the Candidate entity to resolve this?

wolfec
User
Posts: 36
Joined: Fri May 20, 2011 12:40 pm

Re: ParseResume Issue on API 2.0 (URGENT)

Post by wolfec » Tue Nov 08, 2011 4:48 pm

rkarthy wrote:Yes. I checked from my side and now my existing code is working fine and returning the result without any error. But that parsed resume information was not updated on the Candidate entity fields like our legacy API. Do i have to update the hrxml result on the Candidate entity to resolve this?
I have this question as well. The parse method just returns hrxml. It doesn't seem to do anything else (like add html and update the Candidate description field). If you try to save the hrxml back to the Candidate's description field, it is saved without any of the html formatting. What method do we use to convert the parsed resume in a similar way to when you manually click 'parse resume' from within the Bullhorn application??

wolfec
User
Posts: 36
Joined: Fri May 20, 2011 12:40 pm

Re: ParseResume Issue on API 2.0 (URGENT)

Post by wolfec » Thu Nov 10, 2011 11:08 am

I really just need to know if the API does anything other than return hrxml with regard to parsing resumes. Do we have to handle the actual processing of that xml on our end in order for it to show up in the relevant fields in the candidate record?

bernie
User
Posts: 2
Joined: Wed May 06, 2009 3:54 pm

Re: ParseResume Issue on API 2.0 (URGENT)

Post by bernie » Thu Nov 10, 2011 6:35 pm

Curious on this too... i have a client that wants to import a parsed resume for new candidate adds via the api and they were told that the legacy api (how we usually would handle this) will not be installed for them. I'd rather not have to reinvent the wheel. Hopefully I'm just missing the obvious.

Also, I'm under the impression based on previous developer 'support' response that there is no 'merge' function in the api, correct?

Thanks

Post Reply