ParseResume Sample for C#

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
cdmorrow
User
Posts: 17
Joined: Tue May 03, 2011 9:22 am

ParseResume Sample for C#

Post by cdmorrow » Tue Oct 11, 2011 11:55 pm

Does anyone have a working sample of using the 2.0 API to parse a resume using C#? Or, could you point out the error in my code?

Code: Select all

                byte[] resumeData = null;
                using (var binaryReader = new BinaryReader(FileToUpload.PostedFile.InputStream))
                {
                    resumeData = binaryReader.ReadBytes(FileToUpload.PostedFile.ContentLength);
                }


                //Parse Resume
                try
                {
                    apiParseResumeResult parser = bhService.parseResume(bhSession.session, resumeData);
                    bhSession.session = parser.session;
                    if (parser.success)
                    {
                        newCandidate.description = parser.hrXml;
                    }
                }
                catch
                {
                    Response.Redirect("OMG_WTF.aspx");
                }
The above code returns:
parser.success = false
parser.diagnostics = HttpResponseCode=200, InitStatus=null, InitStatusStr=null, StellentStatus=null, StellentStatusStr=null, RexStatus=null, RexStatusStr=null

cdmorrow
User
Posts: 17
Joined: Tue May 03, 2011 9:22 am

Re: ParseResume Sample for C#

Post by cdmorrow » Fri Oct 21, 2011 8:20 am

Bump.

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

Re: ParseResume Sample for C#

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

I'm also in the same situation. Have you got any Reply?

cdmorrow
User
Posts: 17
Joined: Tue May 03, 2011 9:22 am

Re: ParseResume Sample for C#

Post by cdmorrow » Tue Nov 15, 2011 8:25 pm

I hardly ever get a reply from Bullhorn here. Worst. Support. Ever.

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

Re: ParseResume Sample for C#

Post by k.pham » Wed Nov 16, 2011 6:46 pm

cdmorrow,

I already posted the sample code for C# on another topic.
http://supportforums.bullhorn.com/viewt ... 32&t=11921

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);
            
        

Post Reply