Big Help Desk

CV Parsing Code

 

Soap integration with your .Net, PHP, Java, Python applications

Please use ParseResumeNTG Method

 

Web Client in .Net

 

Step 1: Create your web reference within your visual studio project for our CV Resume API. The web reference is (http://www.cvparseapi.com/cvparseapi.asmx) and name your web reference CVParseAPI.

 

Step 2: One example on how to add C# example code to your .net application. The xmlResumeString variable example will now contain the return parsed resume in xml format.

 

Definitions:

·         “bytes” variable contains all the data within the Resume / CV sent to web service to be parsed.

·         openFileDialog1.FileNameis the string name of the document.  In this example an openFileDialog was used to choose the file to be parsed.

·         “Your key” is your registered key in our system to allow you to parse resumes.

·         “Your password” is the password you registered your account with.

 

Soap integration with your PHP applications

Web Client in PHP

 

Step 1: Setup your SOAP Client for the WSDL url http://www.cvparseapi.com/cvparseapi.asmx?WSDL”.

 

Step 2: Use the ParseResumeNTG() method to parse your resume/cv into our xml string containing each element within the original document.

 

 

PHP allows the easy creation and consumption of SOAP based web services.

 

$filename = $_FILES["file"]["name"];

$byteArr = file_get_contents($_FILES['file']['tmp_name']);

$key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';

$password = 'xxxxxxxxx';

 

try {

$wsdloptions = array(

'soap_version' => constant('WSDL_SOAP_VERSION'),


 

'exceptions' => constant('WSDL_EXCEPTIONS'), 'trace' => constant('WSDL_TRACE')

);

 

$client = new SoapClient(constant('DEFAULT_WSDL'), $wsdloptions);

 

//or use the line below without WSDL options

//$client = new SoapClient(http://www.cvparseapi.com/cvparseapi.asmx?WSDL');

 

$args = array(

'data' => $byteArr, 'file' => $filename, 'key' => $key, 'password' => $password

);

 

$myXMLData = $client->ParseResumeNTG($args);

 

echo "Success! Do something with result string";

$xml=simplexml_load_string($myXMLData); print_r($xml);

 

 

} catch (Exception $exc) { echo "Something failed!";

echo "$exc->getTraceAsString()";

}

 

Soap integration with your Java applications

 

 

Web Client in a Java 1.6 Class

Regardless of whether we know the programming language that implements the web service or not, we can easily link applications of different platforms. Web services display to their clients standard XML pages called WSDL, which gives them an idea about what functions they implement. For instance, navigating tohttp://localhost/WebService/Service.asmx?wsdl would generate an XML page with special elements. The ability to read through the WSDL document and to locate elements

like: type, message, portType, binding, service is very crucial, as it tells client developers about the functions hosted by the service (not a documentation). For more information about WSDL documents, visit www.w3schools.com/wsdl/wsdl_documents.asp.

 

Fortunately, enough for JAVA 1.6 developers, is the existence of the JAVA jax-ws package that generates the proxy classes necessary for communicating with the web server.

 

First let’s build the java project in C:\Project7\java_proj\webClient.

 

So, start by creating a new java class called cl.java. (Make sure your current directory isC:\Project7\java_proj\webClient).


Now let’s run the jax-ws utility by typing the following in the command line:

 

Hide  Copy Code

 

C:\Project7\java_proj\webClient >wsimport -keep -p webPack.serv http://localhost/Service.asmx?wsdl

 

The wsimport command will generate the proxy classes we need, -keep keeps the generated source files, andwebPack.serv is the package containing the proxy classes. You could see by examining

the service section of the WSDL file and by browsing through the webPack\serv folders that you have the two main classes CalculatorWebService and CalculatorWebServiceSoap.

 

Next, let’s edit our cl.java client as follows:

 

Hide  Copy Code

 

import webPack.serv.*;

 

public class cl

{

public static void main(String[] args)

{

CalculatorWebService service = new CalculatorWebService (); CalculatorWebServiceSoap soap = service.getPort(CalculatorWebServiceSoap.class);

int x = 5,y = 10; System.out.println(soap.Add(x,y));

 

}

}

 

The getPort method returns the ‘stub’ of the CalculatorWebService class as defined by the web service and lets you access the four calculator methods defined. For instance,

the soap.Add(int,int) method actually calls the server to perform the Add function defined there, and then directs the return value to the client.

 

Testing this class is easy; just compile as follows:

 

Hide  Copy Code

 

>javac classpath . cl.java

 

Then run this program as follows:

 

Hide  Copy Code

 

> java cl

 

You’ll get "15" as an output.


 

Soap integration with your Python applications

 

 

Web Client in Python

 

from os import listdir

from os.path import isfile, join

from zeep import Client

import xmltodict, json

 

# PURPOSE :: TO HELP SPEED UP PROCESS OF RESUME PARSING USING PYTHON.

 

print "Starting Importer... one moment. "

print ""

print "Shaking hands with clients..."

print "-----------------------------"

 

# load in the file.

print "--> Loading Temporary File"

with open("resume.doc", 'r') as content_file:

 

    file_contents = content_file.read() # read the file

    file_name = "resume.doc"  # get from your own processing.

 

    print "--> LOADED"

 

    print "--> Connecting to Parser"

 

    client = Client('http://www.cvparseapi.com/cvparseapi.asmx?WSDL')

    big_endpoint = "http://www.cvparseapi.com/cvparseapi.asmx?WSDL"

    big_key = "YOUR-KEY"

    big_pass = "YOUR-PASSWORD"

 

    result = client.service.ParseResumeNTG(f=file_contents, fileName=file_name, YourKey=big_key, Password=big_pass)

 

    print "--> Connected Passing Data :: Parsing.... (waiting)"

 

    o = xmltodict.parse(result)

    json_data = json.dumps(o)

 

    # now we need to parse the xml.

    print "--> DONE:: Next steps do stuff with daa received ."