java - 使用“application/xml”标头和字符串 xml 作为正文向 HTTPS 服务 url 发送 POST 请求的最佳方式是什么?
问题描述
这种方式没有奏效。
公共字符串 sendReqest(字符串 httpsUrl,字符串 xmlRequest){
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_XML);
HttpEntity<String> httpEntity = new HttpEntity<String>(xmlRequest, httpHeaders);
RestTemplate restTemplate = new RestTemplate();
String result = restTemplate.postForObject(httpsUrl, httpEntity, String.class);
return result;
}
我收到此异常: PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径
解决方案
推荐阅读
- jekyll - 只渲染一个 Jekyll 集合 - 根本没有其他文件
- oracle - 如何使用一种功能测试我的包?
- apache - Brew 安装 Httpd:欢迎使用 Nginx?
- javascript - 在函数 Tabletop 中使用局部变量
- javascript - 函数声明是非静态的吗?
- javascript - 在 Nuxt 应用程序中用 API 中的数据替换 json 文件中的数据的最简单方法
- database - SwiftUi CloudKit 记录修改无法保存“不允许写入操作”
- npm - 我如何在 package.json 中运行这个 npm 脚本?(同时)而我的客户和服务器文件夹有自己的目录
- scala - 隐式视图不起作用 - 是我隐式定义的错吗?
- authentication - 任何开发人员都可以解码密码吗?