Web Services 通过将https.协议设置为TLSv1.2进行wsimport

hlswsv35  于 2022-11-15  发布在  其他
关注(0)|答案(2)|浏览(274)

我想使用wsdl导入Web服务。服务器使用的是TLSv1.2。
我使用java代码通过设置System.setProperty("https.protocols", "TLSv1.2");连接到服务器
我使用的是Java 1.7.0_65,在使用wsimport的时候,我如何做同样的事情呢?
当我尝试wsimport <wsdl-url>

parsing WSDL...

[ERROR] Received fatal alert: protocol_version

Failed to read the WSDL document: https://<server-name>/Test/Test/Transform?wsdl, because 1) could not find the document; /2) the document cou
ld not be read; 3) the root element of the document is not <wsdl:definitions>.

[ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s):

 At least one WSDL with at least one service definition needs to be provided.

    Failed to parse the WSDL.
hpcdzsge

hpcdzsge1#

"C:\Program Files (x86)\Java\jdk1.7.0_80\bin\java" -classpath "C:\Program Files (x86)\Java\jdk1.7.0_80\lib\tools.jar" -Dhttps.protocols=TLSv1.2 com.sun.tools.internal.ws.WsImport -keep -verbose https://<server-name>/Test/Test/Transform?wsdl
agyaoht7

agyaoht72#

请先设置JAVA_TOOL_OPTIONS

set JAVA_TOOL_OPTIONS=-Dhttps.protocols=TLSv1.2

然后,照常执行wsimport

相关问题