Java调用Azkaban的RestFul接口
1、绕过ssl认证的工具类:
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate; import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager; public final class SSLUtil { private static final TrustManager[] UNQUESTIONING_TRUST_MANAGER = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers()
{
return null;
} public void checkClientTrusted(X509Certificate[] certs, String authType)
{
} public void checkServerTrusted(X509Certificate[] certs, String authType)
{
}
} }; public static void turnOffSslChecking() throws NoSuchAlgorithmException, KeyManagementException
{
final SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, UNQUESTIONING_TRUST_MANAGER, null);
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} public static void turnOnSslChecking() throws KeyManagementException, NoSuchAlgorithmException
{
SSLContext.getInstance("SSL").init(null, null, null);
} private SSLUtil()
{
throw new UnsupportedOperationException("Do not instantiate libraries.");
}
}
2、直接测试类:
import java.io.File;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map; import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; public class AzkabanTest { private static final String API = "http://172.16.4.117:9091"; private static final String SESSION_ID = "6102b053-8720-4940-8baf-0bed38748821"; private static final String PROJECT = "test"; private static final String PROJECT_ID = "12"; private static final String SCHEDULE_ID = "13"; private static RestTemplate restTemplate = null; static
{
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(2000);
requestFactory.setReadTimeout(2000);
restTemplate = new RestTemplate(requestFactory);
} public static void main(String[] args) throws Exception
{
loginTest(); // 登录
// createProTest(); // 创建Project
// deleteProTest(); // 删除Project
// uploadZip(); // 上传zip
// scheduleEXEaFlowTest(); // 创建定时任务
// scheduleByCronEXEaFlowTest(); // 创建定时任务cron
// unscheduleFlowTest(); // 取消定时任务
} /**
* 登录测试 登录调度系统
*/
public static void loginTest() throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("action", "login");
linkedMultiValueMap.add("username", "azkaban");
linkedMultiValueMap.add("password", "azkaban"); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String postForObject = restTemplate.postForObject(API, httpEntity, String.class);
System.out.println(postForObject);
} /**
* 创建任务测试 创建一个project
*/
public static void createProTest() throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", SESSION_ID);
linkedMultiValueMap.add("action", "create");
linkedMultiValueMap.add("name", PROJECT);
linkedMultiValueMap.add("description", "testproject"); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String postForObject = restTemplate.postForObject(API + "/manager", httpEntity, String.class);
System.out.println(postForObject);
} /**
* 删除任务测试 删除一个project
*/
public static void deleteProTest() throws Exception
{ SSLUtil.turnOffSslChecking(); HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
hs.add("Accept", "text/plain;charset=utf-8"); Map<String, String> map = new HashMap<>(); map.put("id", SESSION_ID);
map.put("project", PROJECT); ResponseEntity<String> exchange = restTemplate.exchange(API + "/manager?session.id={id}&delete=true&project={project}", HttpMethod.GET, new HttpEntity<String>(hs), String.class, map); System.out.println(exchange.getBody());
System.out.println(exchange.getStatusCode());
System.out.println(exchange.getStatusCodeValue());
} /**
* 上传zip 上传依赖文件 zip包
*/
public static void uploadZip() throws Exception
{
SSLUtil.turnOffSslChecking();
FileSystemResource resource = new FileSystemResource(new File("C:/Users/wuzy/Desktop/1.zip"));
LinkedMultiValueMap<String, Object> linkedMultiValueMap = new LinkedMultiValueMap<String, Object>();
linkedMultiValueMap.add("session.id", SESSION_ID);
linkedMultiValueMap.add("ajax", "upload");
linkedMultiValueMap.add("project", PROJECT);
linkedMultiValueMap.add("file", resource);
String postForObject = restTemplate.postForObject(API + "/manager", linkedMultiValueMap, String.class);
System.out.println(postForObject);
} /**
* Schedule a period-based Flow 根据时间 创建调度任务
*/
public static void scheduleEXEaFlowTest() throws KeyManagementException, NoSuchAlgorithmException
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", SESSION_ID);
linkedMultiValueMap.add("ajax", "scheduleFlow");
linkedMultiValueMap.add("projectName", PROJECT);
linkedMultiValueMap.add("projectId", PROJECT_ID); linkedMultiValueMap.add("flow", "2");
// linkedMultiValueMap.add("scheduleTime", "10,28,am,EDT");
linkedMultiValueMap.add("scheduleTime", "15,08,pm,PDT");
linkedMultiValueMap.add("scheduleDate", "12/1/2017");
linkedMultiValueMap.add("flowName", "test01 description"); // 是否循环
linkedMultiValueMap.add("is_recurring", "on"); // 循环周期 天 年 月等
// M Months
// w Weeks
// d Days
// h Hours
// m Minutes
// s Seconds
linkedMultiValueMap.add("period", "30s"); // 经测试,定时任务支持至少是60秒或其整数倍 HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String postForObject = restTemplate.postForObject(API + "/schedule", httpEntity, String.class);
System.out.println(postForObject);
} /**
* Flexible scheduling using Cron 通过cron表达式调度执行 创建调度任务
*/
public static void scheduleByCronEXEaFlowTest() throws KeyManagementException, NoSuchAlgorithmException
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", SESSION_ID);
linkedMultiValueMap.add("ajax", "scheduleCronFlow");
linkedMultiValueMap.add("projectName", PROJECT);
linkedMultiValueMap.add("cronExpression", "* */1 * * * ?");
linkedMultiValueMap.add("flow", "中文");
linkedMultiValueMap.add("flowName", "dsaf"); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String postForObject = restTemplate.postForObject(API + "/schedule", httpEntity, String.class);
System.out.println(postForObject);
} /**
* Unschedule a Flow 取消一个流的调度
*/
public static void unscheduleFlowTest() throws KeyManagementException, NoSuchAlgorithmException
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", SESSION_ID);
linkedMultiValueMap.add("action", "removeSched");
linkedMultiValueMap.add("scheduleId", SCHEDULE_ID); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String postForObject = restTemplate.postForObject(API + "/schedule", httpEntity, String.class);
System.out.println(postForObject);
} }
3、Spring Boot接口测试:
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate; @Configuration
public class AzkabanConfig { @Bean
public RestTemplate getRestTemplate()
{
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(2000);
requestFactory.setReadTimeout(2000);
RestTemplate restTemplate = new RestTemplate(requestFactory);
return restTemplate;
} }
import java.io.File;
import java.util.Date; public interface IAzkabanService { /**
* Azkaban登录接口,返回sessionId
* @author wuzy
* @date 2017年12月21日
* @return
* @throws Exception
*/
public String login() throws Exception; /**
* Azkaban创建project
* @author wuzy
* @date 2017年12月21日
* @param projectName project名称
* @param description project描述
* @throws Exception
*/
public void createProject(String projectName, String description) throws Exception; /**
* Azkaban删除project
* @author wuzy
* @date 2017年12月21日
* @param projectName project名称
* @throws Exception
*/
public void deleteProject(String projectName) throws Exception; /**
* Azkaban上传zip文件
* @author wuzy
* @date 2017年12月21日
* @param projectName
* @param file
* @return projectId
* @throws Exception
*/
public String uploadZip(String projectName, File file) throws Exception; /**
* 根据时间 创建调度任务
* @author wuzy
* @date 2017年12月21日
* @param projectId
* @param projectName
* @param flow
* @param flowName
* @param recurring 是否循环,on循环
* @param period 循环频率: M Months,w Weeks,d Days,h Hours,m Minutes,s Seconds;如60s,支持分钟的倍数
* @param date 开始时间
* @return 返回scheduleId
* @throws Exception
*/
public String scheduleEXEaFlow(String projectId, String projectName, String flow, String flowName, String recurring, String period, Date date) throws Exception; /**
* 根据cron表达式 创建调度任务
* @author wuzy
* @date 2017年12月21日
* @param projectName
* @param cron
* @param flow
* @param flowName
* @return 返回scheduleId
* @throws Exception
*/
public String scheduleByCronEXEaFlow(String projectName, String cron, String flow, String flowName) throws Exception; /**
* 根据scheduleId取消一个流的调度
* @author wuzy
* @date 2017年12月21日
* @param scheduleId
* @throws Exception
*/
public void unscheduleFlow(String scheduleId) throws Exception; /**
* 下载Azkaban压缩文件
* @author wuzy
* @date 2017年12月22日
* @param projectName
* @param zipPath
* @throws Exception
*/
public void downLoadZip(String projectName, String zipPath) throws Exception;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.ueb.baseplatform.scheduling.common.Constant;
import com.ueb.baseplatform.scheduling.disconf.GlobalConfig;
import com.ueb.baseplatform.scheduling.service.IAzkabanService;
import com.ueb.baseplatform.scheduling.util.SSLUtil; @Service
public class AzkabanServiceImpl implements IAzkabanService { private static final Logger logger = LoggerFactory.getLogger(AzkabanServiceImpl.class); private static final String CONTENT_TYPE = "application/x-www-form-urlencoded; charset=utf-8"; private static final String X_REQUESTED_WITH = "XMLHttpRequest"; @Autowired
private RestTemplate restTemplate; @Autowired
private GlobalConfig globalConfig; @Override
public String login() throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("action", "login");
linkedMultiValueMap.add("username", globalConfig.getAzkUsername());
linkedMultiValueMap.add("password", globalConfig.getAzkPassword()); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String result = restTemplate.postForObject(globalConfig.getAzkUrl(), httpEntity, String.class); logger.info("--------Azkaban返回登录信息:" + result); return new Gson().fromJson(result, JsonObject.class).get("session.id").getAsString();
} @Override
public void createProject(String projectName, String description) throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", login());
linkedMultiValueMap.add("action", "create");
linkedMultiValueMap.add("name", projectName);
linkedMultiValueMap.add("description", description); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String result = restTemplate.postForObject(globalConfig.getAzkUrl() + "/manager", httpEntity, String.class); logger.info("--------Azkaban返回创建Project信息:" + result); // 创建成功和已存在,都表示创建成功
if (!Constant.AZK_SUCCESS.equals(new Gson().fromJson(result, JsonObject.class).get("status").getAsString()))
{
if (!"Project already exists.".equals(new Gson().fromJson(result, JsonObject.class).get("message").getAsString()))
{
throw new Exception("创建Azkaban Project失败");
}
}
} @Override
public void deleteProject(String projectName) throws Exception
{
SSLUtil.turnOffSslChecking(); HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
hs.add("Accept", "text/plain;charset=utf-8"); Map<String, String> map = new HashMap<>(); map.put("id", login());
map.put("project", projectName); ResponseEntity<String> exchange = restTemplate.exchange(globalConfig.getAzkUrl() + "/manager?session.id={id}&delete=true&project={project}", HttpMethod.GET, new HttpEntity<String>(hs),
String.class, map); logger.info("--------Azkaban返回删除Azkaban Project信息:" + exchange); if (HttpStatus.SC_OK != exchange.getStatusCodeValue())
{
throw new Exception("删除Azkaban Project失败");
}
} @Override
public String uploadZip(String projectName, File file) throws Exception
{
SSLUtil.turnOffSslChecking();
FileSystemResource resource = new FileSystemResource(file);
LinkedMultiValueMap<String, Object> linkedMultiValueMap = new LinkedMultiValueMap<String, Object>();
linkedMultiValueMap.add("session.id", login());
linkedMultiValueMap.add("ajax", "upload");
linkedMultiValueMap.add("project", projectName);
linkedMultiValueMap.add("file", resource);
String result = restTemplate.postForObject(globalConfig.getAzkUrl() + "/manager", linkedMultiValueMap, String.class); logger.info("--------Azkaban返回上传文件信息:" + result); if (StringUtils.isEmpty(new Gson().fromJson(result, JsonObject.class).get("projectId").getAsString()))
{
throw new Exception("上传文件至Azkaban失败");
} return new Gson().fromJson(result, JsonObject.class).get("projectId").getAsString();
} @Override
public String scheduleEXEaFlow(String projectId, String projectName, String flow, String flowName, String recurring, String period, Date date) throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", login());
linkedMultiValueMap.add("ajax", "scheduleFlow");
linkedMultiValueMap.add("projectName", projectName);
linkedMultiValueMap.add("projectId", projectId);
linkedMultiValueMap.add("flow", flow);
linkedMultiValueMap.add("flowName", flowName);
linkedMultiValueMap.add("is_recurring", recurring);
linkedMultiValueMap.add("period", period);
scheduleTimeInit(linkedMultiValueMap, date); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String result = restTemplate.postForObject(globalConfig.getAzkUrl() + "/schedule", httpEntity, String.class); logger.info("--------Azkaban返回根据时间创建定时任务信息:" + result); if (!Constant.AZK_SUCCESS.equals(new Gson().fromJson(result, JsonObject.class).get("status").getAsString()) || new Gson().fromJson(result, JsonObject.class).get("scheduleId").getAsInt() < 0)
{
throw new Exception("根据时间创建定时任务失败");
} return new Gson().fromJson(result, JsonObject.class).get("scheduleId").getAsString();
} private void scheduleTimeInit(LinkedMultiValueMap<String, String> linkedMultiValueMap, Date date)
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
Integer year = calendar.get(Calendar.YEAR);
Integer month = calendar.get(Calendar.MONTH) + 1;
Integer day = calendar.get(Calendar.DATE);
Integer hour = calendar.get(Calendar.HOUR_OF_DAY);
Integer minute = calendar.get(Calendar.MINUTE); linkedMultiValueMap.add("scheduleTime", hour + "," + minute + (hour > 11 ? ",pm,PDT" : ",am,EDT"));
linkedMultiValueMap.add("scheduleDate", month + "/" + day + "/" + year);
} @Override
public String scheduleByCronEXEaFlow(String projectName, String cron, String flow, String flowName) throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", login());
linkedMultiValueMap.add("ajax", "scheduleCronFlow");
linkedMultiValueMap.add("projectName", projectName);
linkedMultiValueMap.add("cronExpression", cron);
linkedMultiValueMap.add("flow", flow);
linkedMultiValueMap.add("flowName", flowName); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String result = restTemplate.postForObject(globalConfig.getAzkUrl() + "/schedule", httpEntity, String.class); logger.info("--------Azkaban返回根据cron表达式创建定时任务信息:" + result); if (!Constant.AZK_SUCCESS.equals(new Gson().fromJson(result, JsonObject.class).get("status").getAsString()))
{
throw new Exception("根据cron表达式创建定时任务失败");
} return new Gson().fromJson(result, JsonObject.class).get("scheduleId").getAsString();
} @Override
public void unscheduleFlow(String scheduleId) throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", login());
linkedMultiValueMap.add("action", "removeSched");
linkedMultiValueMap.add("scheduleId", scheduleId); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String result = restTemplate.postForObject(globalConfig.getAzkUrl() + "/schedule", httpEntity, String.class); logger.info("--------Azkaban返回取消流调度信息:" + result); if (!Constant.AZK_SUCCESS.equals(new Gson().fromJson(result, JsonObject.class).get("status").getAsString()))
{
throw new Exception("根据cron表达式创建定时任务失败");
}
} @Override
public void downLoadZip(String projectName, String zipPath)
{
OutputStream output = null;
BufferedOutputStream bufferedOutput = null; try
{
URL url = new URL(globalConfig.getAzkUrl() + "/manager?session.id=" + login() + "&download=true&project=" + projectName);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(3 * 1000);
InputStream inputStream = conn.getInputStream();
File file = new File(zipPath);
output = new FileOutputStream(file);
bufferedOutput = new BufferedOutputStream(output);
bufferedOutput.write(IOUtils.toByteArray(inputStream));
}
catch (Exception e)
{
logger.info("--------下载Azkaban压缩文件异常:" + e.getMessage(), e);
}
finally
{
if (bufferedOutput != null)
{
try
{
bufferedOutput.flush();
bufferedOutput.close();
}
catch (IOException e)
{
logger.info("关闭流异常:" + e.getMessage(), e);
}
} if (output != null)
{
try
{
output.close();
}
catch (IOException e)
{
logger.info("关闭流异常:" + e.getMessage(), e);
}
}
} } }
PS:Azkaban Github API:http://azkaban.github.io/azkaban/docs/latest/#ajax-api
Java调用Azkaban的RestFul接口的更多相关文章
- java调用webservice,restful
java调用webservice public String redoEsb(String loguid, String user, String comments, String newMsg, S ...
- Java 调用 Hbase API 访问接口实现方案
HBase是一个分布式的.面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”.就像Bigtable利用了Google文件 ...
- java调用.net的webservice接口
要调用webservice,首先得有接口,用已经写好的接口地址在myEclipse的目标project中,右键->new web service client-> 选择JAX-WS方式,点 ...
- java 调用wsdl的webservice接口 两种调用方式
关于wsdl接口对于我来说是比较头疼的 基本没搞过.一脸懵 就在网上搜 看着写的都很好到我这就不好使了,非常蓝瘦.谨以此随笔纪念我这半个月踩过的坑... 背景:短短两周除了普通开发外我就接到了两个we ...
- Java调用solrj5.5.3接口,查询数据
前期准备 搭建solr服务 参考上一篇,搭建solr搜索服务. 添加依赖 maven工程的话,添加如下依赖, <!-- https://mvnrepository.com/artifact/or ...
- POST形式 soapUI调用WebService的restful接口,传入json参数,并且返回json
第一次使用POST形式传JSON字符串,怎么都调不到后台方法,只是因为注解没加对…… CXF的WebService接口类 package com.zit.webservice.main; import ...
- java 调用短信 api 接口发送短信
参考: https://blog.csdn.net/u014793522/article/details/59062014 参考 :https://blog.csdn.net/Lu_shilusi ...
- Java 调用 php接口(Ajax)(二)
由于项目里面需要用到Java调用PHP的充值接口,所以学习了一下,以下这个Demo是个小小的例子,写下来做个笔记> jsp页面: <%@ page language="java& ...
- post 中文数据到elasticsearch restful接口报json_parse_exception 问题
我们的客户端程序直接调用es 的restful接口, 通过post json数据去查询, 但post数据有中文的时候,有些中文会报异常,有些中文不会 {"error":{" ...
随机推荐
- A Child's History of England.24
Besides all these troubles, William the Conqueror was troubled by quarrels among his sons. He had th ...
- day 03Linux修改命令提示符
day 03Linux修改命令提示符 昨日回顾 1.选择客户机操作系统: Microsoft Windows # 一次只能安装一台电脑 Linux(推荐) VMware ESX # 服务器版本VNwa ...
- 对于Linq关键字和await,async异步关键字的扩展使用
最近在看neuecc大佬写的一些库:https://neuecc.medium.com/,其中对await,async以及linq一些关键字实现了自定义化使用, 使其不需要引用对应命名空间,不需要多线 ...
- spring认证的一些核心类
SecurityContextHolder, to provide access to the SecurityContext. SecurityContext: to hold the Authen ...
- Oracle bulk collect into 的几种用法
bulk collect 和 forall 联合应用写起来显得有些啰嗦,不过为了速度,多写两句又何妨 建立两个临时表 create table T_TEST ( TESTID NUMBER(19) n ...
- 如何在linux 上配置NTP 时间同步?
故障现象: 有些应用场景,对时间同步的要求严格,需要用到NTP同步,如何在linux上配置NTP时间同步? 解决方案: 在linux 上配置NTP 时间同步,具休操作步骤,整理如下: 1.安装软件包( ...
- 【Xcode】sh: pause: command not found
system("pause"); 只适合于DOS和Windows系统,不适合Linux系统. 直接删掉就可以. 或者改为: #include <unistd.h> pa ...
- 【HarmonyOS】【DevEco Studio】NOTE05:PageAbility生命周期的呈现
NOTE05:PageAbility生命周期的呈现 基本界面设置 创建Slice与对应xml BarAbilitySlice package com.example.myapplication.sli ...
- shell脚本 比较mysql配置文件
一.简介 源码地址 日期:2019/12/19 介绍:较两个mysql实例的配置是否一致,支持比较配置文件,也支持比较系统变量的值 效果图: 二.使用 适用:centos6+ 语言:中文 注意:无 下 ...
- TMS570LS3137笔记-内部Flash FEE使用
1.基本简介 TMS570LS3137内部Flash分为三个 Bank,主Flash 数据存储区3MB,是Bank1和Bank2.还有一个Bank7是作为内部Flash模拟EEPROM使用.内部存储器 ...