简体   繁体   English

如何使用Apache CXF为Secure(https)soap Web服务生成Java类

[英]How to generate java classes for secured(https) soap web service using Apache cxf

I tried to generate web service classes from following url https://example.com:20008/mws-ws/services/TL_M3_PRSystem_Integration?wsdl this web service is working under a specific VPN. 我试图从以下URL https://example.com:20008/mws-ws/services/TL_M3_PRSystem_Integration?wsdl生成Web服务类,该Web服务在特定的VPN下工作。

I used apache cxf to generate java classes for this web service. 我使用apache cxf为该Web服务生成Java类。

Then I got following error on cmd, 然后我在cmd上遇到以下错误,

在此处输入图片说明

I could generate classes when I used an unsecured soap web service. 使用不安全的Soap Web服务时,可以生成类。

Anyone have idea about this ? 有人对此有想法吗?

It's most likely signed by a self-signed (untrusted) certificate. 它最有可能由自签名(不受信任)证书签名。 The easiest way is to add this certificate to the cacerts java keystore or add it to a custom store and run wsimport with javax.net.ssl.trustStore property set to the custom store. 最简单的方法是将此证书添加到cacerts java密钥库中或将其添加到自定义存储中,然后在javax.net.ssl.trustStore属性设置为自定义存储的情况下运行wsimport

  1. Go to url in Chrome and use the Security tab in Dev tools to export the certificate to a file. 转到Chrome中的url,然后使用开发工具中的“安全性”标签将证书导出到文件中。
  2. Use the keystore tool to import the certificate into cacerts keystore. 使用keystore工具将证书导入cacerts密钥库。

In the terminal: 在终端中:

$JAVA_HOME/bin/keytool -import -alias MyCustomCert -keystore $JAVA_HOME/jre/lib/security/cacerts -file ~/path/to/saved/cert

or on Windows: 或在Windows上:

%JAVA_HOME%\bin\keytool -import -alias MyCustomCert -keystore %JAVA_HOME%\jre\lib\security\cacerts -file C:\whereever\the\file\is

Make sure JAVA_HOME environment variable is defined and the command prompt you're using has permission to write to the %JAVA_HOME%\\jre\\lib\\security\\cacerts file. 确保已定义JAVA_HOME环境变量,并且所使用的命令提示符具有写入%JAVA_HOME%\\jre\\lib\\security\\cacerts文件的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM