- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在构建一个使用 SOAP over https 与多个设备通信的服务。这些设备公开相同的网络服务 API(相同的 wsdl)。可以在运行时随时将新设备添加到该方案中。
我需要动态查询这些设备中的每一个以及将来可能添加的任何设备。这些设备中的每一个都有一个用于 ssl 的自签名证书。我正在构建的服务需要使用 Spring Integration 来实现。
鉴于以上,我有两个主要问题:
如有任何帮助,我们将不胜感激。
最佳答案
感谢 Gary 和 Artem 的帮助。
我能够使用线程局部变量和 SPEL 解决动态 uri 的问题。
为了信任自签名证书,我使用 httpclient 实现了新的消息发送器。 HttpClient 提供了一个 TrustSelfSignedStrategy。我用它来信任所有自签名证书。解决方案似乎有效。代码如下,以后有类似需求的 friend 可以引用。
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
InputStream instream = getClass().getResourceAsStream(trustStoreFile);
try {
trustStore.load(instream, trustStorePassword.toCharArray());
} finally {
instream.close();
}
SSLContextBuilder builder = new SSLContextBuilder();
builder.loadTrustMaterial(trustStore, new TrustSelfSignedStrategy());
SSLContext sslcontext = builder.build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext,SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
HttpClientBuilder httpClientBuilder = HttpClients.custom();
httpClientBuilder.setSSLSocketFactory(sslsf);
httpClientBuilder.addInterceptorFirst(new RemoveSoapHeadersInterceptor());
if (credentials!=null){
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(AuthScope.ANY,credentials);
httpClientBuilder.setDefaultCredentialsProvider(credsProvider);
}
CloseableHttpClient closeableHttpclient = httpClientBuilder.build();
setHttpClient(closeableHttpclient);
关于web-services - 具有动态 uri 的 spring 集成出站 web 服务网关并信任所有证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24536998/
前不久,哔哩哔哩(一般常称为 B 站)发布了一篇文章《2021.07.13 我们是这样崩的》,详细回顾了他们在 2021.07.13 晚上全站崩溃约 3 小时的至暗时刻,以及万分紧张的故障定位与恢复过
想象一下这种情况,周围有一些智能手机和计算机,它们的 WiFi 适配器(无线适配器)打开,但没有必要连接到网络。 有没有办法通过 Linux 机器查看 MAC 地址? 任何见解表示赞赏。 最佳答案 断
我无法创建新的 Window Station 来运行我的应用程序 int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { wprintf(L"
在 Conda 环境中安装包后,我想对该包中的代码进行一些更改。 在哪里可以找到包含已安装包的 site-packages 目录? 我有 Anaconda Python 2.7 base 发行版,但找
今天去改了matplotlib的配置。搜索 matplotlibrc 发现我有两个: 查看site-packages 文件夹,我发现很多包的名称中都有波浪号: ~klearn 是 sklearn ,但
我是一名优秀的程序员,十分优秀!