Web服务代理中的SSL证书问题 [英] SSL certificate problem in a web service proxy

查看:210
本文介绍了Web服务代理中的SSL证书问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个JAVA Web服务客户端,我在其中连接到服务。

I am building a JAVA web service client in which i connect to a service.

此服务具有ssl证书验证。

This service has a ssl certificate verification.

如何使用ssl证书验证来调用此服务。

How to call this service using ssl certificate verification.

我在使用Eclipse构建的客户端中使用JAX-RPC实现。

I am using JAX-RPC implementation in client built using Eclipse.

一个例子是appriciated。

An example would be appriciated.

推荐答案

我能够进行Web服务连接...

I am able to do the web service connection...

我使用以下命令添加了密钥库:

I added the key store using the command:

keytool -import -trustcacerts -file <file path/filename.cer> -alias <aliasName> -keystore <JAVA_HOME/jre/lib/security/cacerts> 

将密码设为changeit并在密钥库中添加证书。

gave the password as "changeit" and added the certificate in keystore.

现在在代码中我添加了两行:

Now in code i added two lines:

System.setProperty("javax.net.ssl.trustStore", "<JAVA_HOME>/jre/lib/security/cacerts");
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");

还添加了

_call.setUsername("username");
_call.setPassword("password"); 

其中_call是Call Class的调用对象。

where _call is the call object of Call Class.

它有效!!!!!!

这篇关于Web服务代理中的SSL证书问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆