问题描述
我正在尝试为 Sabre Retrieve Itinerary 生成工件。
这是我正在使用的脚本:
wsimport -keep \
-verbose \
https://developer.sabre.com/sites/default/files/resources/8258/GetReservation_1.19.0.wsdl \
-B-XautoNameResolution \
-Xnocompile
但是我收到以下警告,即使生成了 Java 代码,我也不确定它是否正确。
[WARNING] schema_reference: Failed to read schema document 'msg-header-2_0.xsd',because 'https' access is not allowed due to restriction set by the accessExternalSchema property.
line 4 of https://developer.sabre.com/sites/default/files/resources/8258/GetReservation_1.19.0.wsdl#types?schema1
这个警告有点奇怪,因为 WSDL 包含这一行:
<xsd:import namespace="http://www.ebxml.org/namespaces/messageHeader" schemaLocation="msg-header-2_0.xsd"/>
所以 msg-header-2_0.xsd 是通过 http 而不是 https 引用的。
到目前为止我尝试过的:
javax.xml.accessExternalSchema = all
- 我按照建议添加了一个附加选项in this post:
-J-Djavax.xml.accessExternalSchema=all
但是这些都没有帮助。我的设置如下:
java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (Zulu 8.54.0.21-CA-macosx) (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (Zulu 8.54.0.21-CA-macosx) (build 25.292-b10,mixed mode)
有没有其他人遇到过这个问题或知道如何解决它?
解决方法
以下命令对我有用...
wsimport -J-Djavax.xml.accessExternalDTD=all -J-Djavax.xml.accessExternalSchema=all -keep -verbose https://developer.sabre.com/sites/default/files/resources/8258/GetReservation_1.19.0.wsdl -Xnocompile