- 浏览: 2566944 次
- 性别:
- 来自: 成都
-
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Resume Parse Solution(2)SOAP - wsimport
That is really amazing, that JAX-WS tool is really in $JDK/bin.
After I install ORACLE JDK 1.8 on my MAC OX, I really have wsimport
> which wsimport
/usr/bin/wsimport
Help information
> wsimport -help
Usage: wsimport [options] <WSDL_URI>
How SOAP Works
Usually, we will have a WSDL file which will describe all the services for us.
Let rock and roll to use wsimport to generate that.
> wsimport -keep -verbose -B-XautoNameResolution -s src/main/java/ -p com.sillycat.resumeparse.sovren.ws http://services.resumeparsing.com/ParsingService.asmx?wsdl
Error Message:
[ERROR] A class/interface with the same name "com.resumeparsing.services.ParseJobOrderResponse" is already in use. Use a class customization to resolve this conflict.
line 130 of http://services.resumeparsing.com/ParsingService.asmx?wsdl
Solution:
Add this in the command line
wsimport -keep -verbose -B-XautoNameResolution http://services.resumeparsing.com/ParsingService.asmx?wsdl
That is the solution -B-XautoNameResolution
All the codes will be generated under this directory ws. Then we can write a class to call that.
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.net.MalformedURLException;
import java.net.URL;
import java.util.zip.GZIPOutputStream;
import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.sillycat.resumeparse.ParsingServiceClient;
import com.sillycat.resumeparse.sovren.ws.ParseResumeRequest;
import com.sillycat.resumeparse.sovren.ws.ParseResumeResponse2;
import com.sillycat.resumeparse.sovren.ws.ParsingService;
import com.sillycat.resumeparse.sovren.ws.ParsingServiceSoap;
public class ParsingServiceSovrenJaxWSClient implements ParsingServiceClient {
protected final static Log log = LogFactory
.getLog(ParsingServiceSovrenJaxWSClient.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();
// Get a client proxy for the web service
ParsingService service = null;
try {
service = new ParsingService(new URL(
"https://services.resumeparsing.com/ParsingService.asmx?wsdl"),
new QName("http://services.resumeparsing.com/",
"ParsingService"));
} catch (MalformedURLException e) {
log.error(e,e);
}
ParsingServiceSoap soap = service.getParsingServiceSoap();
// Required parameters
ParseResumeRequest parseRequest = new ParseResumeRequest();
parseRequest.setAccountId(this.getAccountId());
parseRequest.setServiceKey(this.getServiceKey());
parseRequest.setFileBytes(bytes);
long call_api_start = System.currentTimeMillis();
ParseResumeResponse2 parseResult = soap.parseResume(parseRequest);
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");
log.debug("Code=" + parseResult.getCode());
log.debug("SubCode=" + parseResult.getSubCode());
log.debug("Message=" + parseResult.getMessage());
log.debug("TextCode=" + parseResult.getTextCode());
log.debug("CreditsRemaining="
+ parseResult.getCreditsRemaining());
log.debug("-----");
log.debug(parseResult.getXml());
}
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();
}
}
…snip...
}
Reference:
http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/
http://www.mkyong.com/webservices/jax-ws/jax-ws-wsimport-tool-example/
That is really amazing, that JAX-WS tool is really in $JDK/bin.
After I install ORACLE JDK 1.8 on my MAC OX, I really have wsimport
> which wsimport
/usr/bin/wsimport
Help information
> wsimport -help
Usage: wsimport [options] <WSDL_URI>
How SOAP Works
Usually, we will have a WSDL file which will describe all the services for us.
Let rock and roll to use wsimport to generate that.
> wsimport -keep -verbose -B-XautoNameResolution -s src/main/java/ -p com.sillycat.resumeparse.sovren.ws http://services.resumeparsing.com/ParsingService.asmx?wsdl
Error Message:
[ERROR] A class/interface with the same name "com.resumeparsing.services.ParseJobOrderResponse" is already in use. Use a class customization to resolve this conflict.
line 130 of http://services.resumeparsing.com/ParsingService.asmx?wsdl
Solution:
Add this in the command line
wsimport -keep -verbose -B-XautoNameResolution http://services.resumeparsing.com/ParsingService.asmx?wsdl
That is the solution -B-XautoNameResolution
All the codes will be generated under this directory ws. Then we can write a class to call that.
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.net.MalformedURLException;
import java.net.URL;
import java.util.zip.GZIPOutputStream;
import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.sillycat.resumeparse.ParsingServiceClient;
import com.sillycat.resumeparse.sovren.ws.ParseResumeRequest;
import com.sillycat.resumeparse.sovren.ws.ParseResumeResponse2;
import com.sillycat.resumeparse.sovren.ws.ParsingService;
import com.sillycat.resumeparse.sovren.ws.ParsingServiceSoap;
public class ParsingServiceSovrenJaxWSClient implements ParsingServiceClient {
protected final static Log log = LogFactory
.getLog(ParsingServiceSovrenJaxWSClient.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();
// Get a client proxy for the web service
ParsingService service = null;
try {
service = new ParsingService(new URL(
"https://services.resumeparsing.com/ParsingService.asmx?wsdl"),
new QName("http://services.resumeparsing.com/",
"ParsingService"));
} catch (MalformedURLException e) {
log.error(e,e);
}
ParsingServiceSoap soap = service.getParsingServiceSoap();
// Required parameters
ParseResumeRequest parseRequest = new ParseResumeRequest();
parseRequest.setAccountId(this.getAccountId());
parseRequest.setServiceKey(this.getServiceKey());
parseRequest.setFileBytes(bytes);
long call_api_start = System.currentTimeMillis();
ParseResumeResponse2 parseResult = soap.parseResume(parseRequest);
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");
log.debug("Code=" + parseResult.getCode());
log.debug("SubCode=" + parseResult.getSubCode());
log.debug("Message=" + parseResult.getMessage());
log.debug("TextCode=" + parseResult.getTextCode());
log.debug("CreditsRemaining="
+ parseResult.getCreditsRemaining());
log.debug("-----");
log.debug(parseResult.getXml());
}
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();
}
}
…snip...
}
Reference:
http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/
http://www.mkyong.com/webservices/jax-ws/jax-ws-wsimport-tool-example/
发表评论
-
Stop Update Here
2020-04-28 09:00 331I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 491NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 377Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 381Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 351Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 439Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 449Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 392Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 475VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 401Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 496NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 438Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 346Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 262GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 463GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 336GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 322Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 330Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 306Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(1)Running with Component
2020-02-19 01:17 320Serverless with NodeJS and Tenc ...
相关推荐
在`parse5-master`这个压缩包中,很可能包含了parse5库的源码和相关资源,你可以通过阅读源码、查看示例和文档来更深入地理解这个库的工作原理,以及如何有效地使用`parse5-htmlparser2-tree-adapter`。同时,熟悉这...
Wsdl wsdl = Wsdl.parse(wsdlPath); List<QName> qNameList = wsdl.getBindings(); List,List,String>>>> bindList = new ArrayList,List,String>>>>(); for(int i=0;i();i++){ String localPart = qNameList....
"parse-android-test-app"是一个开源项目,专门设计用于测试Android应用程序对服务器数据的解析能力。这个项目可以帮助开发者验证和优化他们的数据解析逻辑,确保在实际应用中能够正确、高效地处理各种数据格式。 ...
官方离线安装包,测试可用。请使用rpm -ivh [rpm完整包名] 进行安装
《Python库解析:parse-torrent-title-1.4.tar.gz》 在信息技术领域,Python以其简洁易读的语法和强大的库支持,成为了开发者们青睐的编程语言之一。本篇文章将聚焦于一个名为`parse-torrent-title`的Python库,...
resume-parse-evaluation Evaluate existing engine of resume parse for Chinese 对各种简历解析工具的测评 从简历中提取感兴趣的字段 Background 一般来讲,不同的候选者和公司所选择的招聘渠道的不同,我们会收到...
Arduino-Parse-SDK-Arduino.zip,arduino sdk for the parse platformwarning-由于缺少使用和贡献,此项目已退出,如果您希望继续使用,请分叉或如果您希望维护此项目,请让您自己知道,Arduino是一家开源软硬件公司和...
parse-server-example, 使用Express和解析服务器模块的示例服务器 parse-server-example使用解析服务器 MODULE的示例项目。阅读下面的完整解析服务器指南: ...
基于串口通信,用verilog实现的数据帧格式解析示范,如PC通过串口,发一串数据包,数据包格式为:头,命令,长度,参数列表... FPGA这边串口接收数据,并逐字节解析PC过来的数据包,根据解析结果,确定下一步执行...
接受一个字符串或缓冲区: var fs = require ( 'fs' )var parse = require ( 'parse-bmfont-xml' )fs . readFileSync ( __dirname + '/Arial.fnt' , function ( err , data ) { var result = parse ( data ) ...
2. 对SOAP消息进行签名和加密,以防止中间人攻击。 3. 对敏感数据进行脱敏处理。 4. 遵循最小权限原则,仅授予解析SOAP消息所需的最小权限。 总之,SOAP作为Web服务的一种通信方式,其解析在iOS开发中涉及到XML解析...
标题“parse-no-sample-id-all.rar_event”暗示我们关注的是一个与事件处理相关的代码样本,具体是针对Linux操作系统版本2.13.6的。描述提到的是“process event”源代码,意味着我们将深入探讨Linux内核中的事件...
官方离线安装包,亲测可用
解析Android版SDK 该库可让您从Android应用访问强大的Parse云平台。 有关Parse及其功能的更多信息,请,和。 相依性 将此添加到您的根build.... implementation " com.github.parse-community.Parse-SDK-Android:go
1、文件内容:perl-Parse-Yapp-1.05-50.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/perl-Parse-Yapp-1.05-50.el7.tar.gz #Step2、进入解压后的目录,...
parse-android-1.13.1.jar,parse-android-1.13.1-sources.jar
资源分类:Python库 所属语言:Python 资源全名:dbc_parse-1.0.7-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
1、文件内容:perl-DateTime-Format-DateParse-0.05-5.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/perl-DateTime-Format-DateParse-0.05-5.el7.tar.gz ...
Jboss启动报Failed to parse WEB-INF/web.xml; - nested throwable错误解决方案 在Jboss应用服务器中,启动报错Failed to parse WEB-INF/web.xml; - nested throwable是一种常见的错误,本文将对此错误进行深入分析...
perl516-perl-Parse-CPAN-Meta-1.4404-1.el6.centos.alt.noarch.rpm