`
sillycat
  • 浏览: 2551885 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Resume Parse Solution(1)Sovren and Axis2 SOAP Client

 
阅读更多
Resume Parse Solution(1)Sovren and Axis2 SOAP Client

1. Commercial Solution
sovren
http://www.sovren.com/

Rchilli
http://rchilli.com/

HireAbility
http://www.hireability.com/

Daxtra
http://www.daxtra.com/

2. Open Source Solution
…todo...

3. Demo and Try SovRen
My lovely SOAP, I will use wsdl and SOAP again after 5 years...
Axis2
Install and Prepare Axis2
http://mirror.metrocast.net/apache//axis/axis2/java/core/1.6.3/axis2-1.6.3-bin.zip

unzip the file and find a nice place for that.
> wsdl2java.sh -help
Using AXIS2_HOME: /opt/axis2
Using JAVA_HOME:  /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
Usage: WSDL2Java [options] -uri <url or path> : A url or path to a WSDL

Here is the command to generate the codes
> wsdl2java.sh -uri http://services.resumeparsing.com/ParsingService.asmx?wsdl -S src/main/java/ -p com.sillycat.resumeparse.sovren.stub -t --noBuildXML -or

-uri   URL of the wsdl file
-S     source file location
-p     customer package name
-t      Generate the test Class (Not much use)
—noBuildXML   No build the build.xml, because I am using maven
-or    overwrite the file

Here is the dependencies in pom.xml
<dependency> 
          <groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.15</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.15</version>
</dependency>
<dependency>
<groupId>org.apache.neethi</groupId>
<artifactId>neethi</artifactId>
<version>3.0.3</version>
</dependency>

Write the Implementation Class, ParsingServiceSovrenClient.java

package com.sillycat.resumeparse.sovren;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.rmi.RemoteException;
import java.util.zip.GZIPOutputStream;

import javax.activation.DataHandler;

import org.apache.axiom.attachments.ByteArrayDataSource;
import org.apache.axis2.AxisFault;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.sillycat.resumeparse.ParsingServiceClient;
import com.sillycat.resumeparse.sovren.stub.ParsingServiceStub;
import com.sillycat.resumeparse.sovren.stub.ParsingServiceStub.ParseResume;
import com.sillycat.resumeparse.sovren.stub.ParsingServiceStub.ParseResumeRequest;
import com.sillycat.resumeparse.sovren.stub.ParsingServiceStub.ParseResumeResponse;
import com.sillycat.resumeparse.sovren.stub.ParsingServiceStub.ParseResumeResponseE;

public class ParsingServiceSovrenClient implements ParsingServiceClient {

    protected final static Log log = LogFactory
            .getLog(ParsingServiceSovrenClient.class);

    private String accountId;

    private String serviceKey;

    private String filePath;

    private String soapServer;

    public void parseResume(String fileName) {

        long read_file_start = System.currentTimeMillis();
        byte[] bytes = null;
        try {
            bytes = getBytesFromFile(new File(filePath + fileName));
        } catch (IOException e) {
            log.error(e,e);
        }
        long read_file_end = System.currentTimeMillis();

        // Optionally, compress the bytes to reduce network transfer time
        long gzip_file_start = System.currentTimeMillis();
        try {
            bytes = gzip(bytes);
        } catch (IOException e) {
            log.error(e,e);
        }
        long gzip_file_end = System.currentTimeMillis();

        ByteArrayDataSource rawData = new ByteArrayDataSource(bytes);
        DataHandler fileData = new DataHandler(rawData);

        // Get a client proxy for the web service
        ParsingServiceStub stub = null;
        try {
            if(this.getSoapServer() != null && !this.getSoapServer().equals("")){
                stub = new ParsingServiceStub(this.getSoapServer());
            }else{
                stub = new ParsingServiceStub();
            }
        } catch (AxisFault e) {
            log.error(e,e);
        } catch(Exception e){
            log.error(e, e);
        }

        // Required parameters
        ParseResumeRequest request = new ParseResumeRequest();
        request.setAccountId(this.getAccountId());
        request.setServiceKey(this.getServiceKey());
        request.setFileBytes(fileData);
        ParseResume resumeRequest = new ParseResume();
        resumeRequest.setRequest(request);

        long call_api_start = System.currentTimeMillis();
        ParseResumeResponse response = null;
        try {
            ParseResumeResponseE result1 = stub.parseResume(resumeRequest);
            if (result1 != null) {
                response = result1.getParseResumeResult();
            }
        } catch (RemoteException e) {
            log.error(e,e);
        }
        long call_api_end = System.currentTimeMillis();

        log.info("Load the file to Memory, using "
                + (read_file_end - read_file_start) + " ms");
        log.info("Zip the file, using " + (gzip_file_end - gzip_file_start)
                + " ms");
        log.info("Call the API, using "
                + (call_api_end - call_api_start) + " ms");

        if (response != null) {
            log.debug("--------------------------------");
            log.debug("Code=" + response.getCode());
            log.debug("SubCode=" + response.getSubCode());
            log.debug("Message=" + response.getMessage());
            log.debug("TextCode=" + response.getTextCode());
            log.debug("CreditsRemaining=" + response.getCreditsRemaining());
            log.debug("--------------------------------");
            log.debug(response.getXml());
            log.debug("--------------------------------");
        }
    }

    private byte[] getBytesFromFile(File file) throws IOException {
        InputStream is = new FileInputStream(file);
        try {

            // Get the size of the file
            long length = file.length();

            if (length > Integer.MAX_VALUE) {
                // File is too large
            }

            // Create the byte array to hold the data
            byte[] bytes = new byte[(int) length];

            // Read in the bytes
            int offset = 0;
            int numRead = 0;
            while (offset < bytes.length
                    && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
                offset += numRead;
            }

            // Ensure all the bytes have been read in
            if (offset < bytes.length) {
                throw new IOException("Could not completely read file "
                        + file.getName());
            }

            // Return the file content
            return bytes;
        } finally {
            // Close the input stream
            is.close();
        }
    }

    private byte[] gzip(byte[] bytes) throws IOException {
        ByteArrayOutputStream byteStream = new ByteArrayOutputStream(
                bytes.length / 2);
        try {
            GZIPOutputStream zipStream = new GZIPOutputStream(byteStream);
            try {
                zipStream.write(bytes);
            } finally {
                zipStream.close();
            }
            return byteStream.toByteArray();
        } finally {
            byteStream.close();
        }
    }

}

Here is the Test Class, SovrenParsingServiceClientTest.java

package com.sillycat.resumeparse;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

import com.sillycat.resumeparse.sovren.ParsingServiceSovrenClient;


public class SovrenParsingServiceClientTest extends BaseTest{

    ParsingServiceClient parsingServiceClient;

    @Before
    public void setUp() {
        parsingServiceClient = new ParsingServiceSovrenClient();
        parsingServiceClient.setAccountId(“xxxxxxx");
        parsingServiceClient.setServiceKey(“xxxxxxxx");
        parsingServiceClient.setFilePath("/Users/carl/data/resume/");
    }

    @Test
    public void dummy(){
        Assert.assertTrue(true);
    }

    @Test
    public void parseResume(){
        parsingServiceClient.parseResume(“5-carl.pdf");
    }

}




References:
http://resumeparsing.com/ResumeService.htm
http://resumeparsing.com/ParsingService.htm

Some SOAP Method
http://sillycat.iteye.com/blog/562769
http://sillycat.iteye.com/blog/1555080
http://sillycat.iteye.com/blog/978895
http://sillycat.iteye.com/blog/716791
http://sillycat.iteye.com/blog/706076
http://sillycat.iteye.com/blog/562769

http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jst.ws.cxf.doc.user%2Ftasks%2Fcreate_client.html

Three popular SOAP provider
http://projects.spring.io/spring-ws/
http://axis.apache.org/axis2/java/core/download.cgi
http://cxf.apache.org/download.html

Async SOAP Client
http://downloads.typesafe.com/rp/play-soap/PlaySoapClient.html
https://www.playframework.com/documentation/3.0.x/ScalaWS
https://github.com/vmencik/soap-async

JAX-WS WSDL
http://www.mkyong.com/webservices/jax-ws/jax-ws-wsimport-tool-example/
http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/

分享到:
评论

相关推荐

    Axis2 SOAP XML报文节点首字母小写转大写,节点命名空间前缀添加与剔除(JAVA)

    在开发基于SOAP(Simple Object Access Protocol)的服务时, Axis2 是一个常见的Java Web服务框架。在处理SOAP XML报文时,我们可能遇到一些规范性问题,例如节点首字母大小写的转换,以及节点命名空间前缀的添加与...

    Android环境下Ksoap连接Axis2

    Axis2是一个流行的Java Web服务框架,而Ksoap2则是一个轻量级的库,用于在Android平台上实现SOAP(简单对象访问协议)通信。本篇文章将详细介绍如何在Android环境中使用Ksoap2连接到Axis2服务,并且传递自定义类对象...

    前端开源库-parse5-htmlparser2-tree-adapter

    在`parse5-master`这个压缩包中,很可能包含了parse5库的源码和相关资源,你可以通过阅读源码、查看示例和文档来更深入地理解这个库的工作原理,以及如何有效地使用`parse5-htmlparser2-tree-adapter`。同时,熟悉这...

    Java开发cad软件源码-resume-parse-evaluation:Evaluateexistingengineofresumepar

    resume-parse-evaluation Evaluate existing engine of resume parse for Chinese 对各种简历解析工具的测评 从简历中提取感兴趣的字段 Background 一般来讲,不同的候选者和公司所选择的招聘渠道的不同,我们会收到...

    实现类似av_parser_parse2功能

    本篇文章将深入探讨如何实现一个类似`av_parser_parse2`的功能,这是FFmpeg中用于解析媒体数据的关键函数。我们将讨论NAL单元(Network Abstraction Layer Unit)在H264视频解码中的作用,以及`av_parser_parse2`在...

    Soap格式数据解析

    3. **Third-party库**:例如SOAPClient,专门用于处理SOAP请求和响应。它们通常提供更高层次的抽象,简化了与SOAP服务的交互。 三、解析流程 1. **接收SOAP消息**:当应用收到SOAP消息时,通常以字符串或NSData...

    Beginning App Development with Parse and PhoneGap 无水印pdf 0分

    Beginning App Development with Parse and PhoneGap teaches you how to start app development with Parse and PhoneGap: free and open source software. Using the building block languages of the web--HTML, ...

    JSON2.JS JSON.JS JSON_PARSE.JS

    method and a parse method. The parse method uses the eval method to do the parsing, guarding it with several regular expressions to defend against accidental code execution hazards. On current ...

    rtsp client rtp parse packages

    本项目"rtsp client rtp parse packages"专注于C++语言实现的RTSP客户端,能够发送TCP消息并解析RTP数据包。 首先,我们要理解RTSP客户端的角色。RTSP客户端通常用于请求服务器流式传输多媒体内容,它通过发送RTSP...

    java.text.ParseException: Unparseable date: 2/10/2010 15:20:05

    在给定的标题 "java.text.ParseException: Unparseable date: 2/10/2010 15:20:05" 中,问题的核心在于日期格式“2/10/2010 15:20:05”没有被正确地识别和解析。 这个异常表明,程序正在尝试将这个日期字符串转换成...

    [iOS] Parse 应用开发 (iOS SDK 实现) (英文版)

    Understand and write your code on cloud to minimize the load on the client side Learn how to create your own applications using Parse SDK, with the help of the step- by- step, practical tutorials ☆ ...

    json2.js 支持JSON.parse方法

    使不支持JSON.parse的浏览器,可以使用JSON.parse方法。 提供兼容性。

    pbap_client_parse.rar_pbap

    在本案例中,"pbap_client_parse.rar_pbap" 提供的是一个 PBAP 客户端的 C 语言实现,这对于我们理解蓝牙设备间的通信以及如何通过编程接口访问远程设备的电话簿非常有用。下面我们将深入探讨 PBAP 协议及其 C 语言...

    Android与服务器端数据交互(基于SOAP协议整合android webservice)

    在Android中,由于资源限制,我们不能直接使用Java客户端中的库(如XFire, Axis2, CXF等)来访问Web服务。这时,KSOAP2库就派上了用场。KSOAP2是一个专门为Android设计的轻量级库,它允许Android应用与使用SOAP协议...

    CommandScript And XmlParse

    标题“CommandScript And XmlParse”涉及的是一个关于命令脚本处理和XML解析的议题。在这个主题中,我们主要探讨两个核心概念:CommandScript和XmlParse。CommandScript通常指的是使用编程语言编写的一系列命令,...

    h264_parse解析工具

    1. **编码器调试**:当开发新的H.264编码算法时,可以通过h264_parse验证输出的码流是否符合标准,检查NAL单元的正确性和完整性。 2. **播放器开发**:在实现H.264视频播放功能时,可以利用该工具来检测和调试NAL...

    matlab开发-parseParameters

    在MATLAB中,我们可以使用`name1=value1, name2=value2,...`这样的格式来传递参数。这种语法在定义函数时非常有用,因为它允许用户在调用函数时自由地指定参数。例如,一个函数定义可能如下所示: ```matlab ...

    Laravel开发-laravel-parse

    在本文中,我们将深入探讨Laravel开发中的一个重要组件——laravel-parse。这是一个专门为Laravel框架设计的Parse SDK桥接器,允许开发者轻松地在Laravel应用程序中集成Parse服务。Parse是一个强大的后端即服务平台...

    易语言soap消息解析

    易语言soap消息解析源码,soap消息解析,init,eachMethod,getMethodReturnInfo,getMethodInfo,getElementName,IsContinue,invoke,getTargetNamespace,parseError

Global site tag (gtag.js) - Google Analytics