我正在尝试使用像这样的Ant构建文件从WSDL生成客户端jar:
<target name="generateWSClient">
<setproxy proxyhost="proxy" proxyport="port" />
<wsimport wsdl="https://mywsdl" destdir="${build.dir}/clientclasses"
verbose="true" package="com.locationservice.client">
</wsimport>
<jar destfile="${build.dir}/${lis.jar.name}"
basedir="${build.dir}/clientclasses" />
<javac srcdir="${src.dir}" destdir="${build.dir}/clientclasses"
includes="com/locationservice/client/*.java">
<classpath refid="client.classpath" />
</javac>
</target>
但是当我运行Ant时,我得到了这个异常:
[wsimport] parsing WSDL...
[wsimport] [ERROR] sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[wsimport] Failed to read the WSDL document: https://mywsdl, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
[wsimport] [ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s):
[wsimport] At least one WSDL with at least one service definition needs to be provided.
[wsimport] Failed to parse the WSDL.
有关如何解决此问题的任何指示?
答案 0 :(得分:0)
我认为https://mywsdl
中的<wsimport>
必须指向有效的WSDL文档。
答案 1 :(得分:0)
看起来,运行ant脚本的计算机没有适用于外部服务器的证书。 您正尝试通过HTTPS访问WSDL,这可能需要安装证书。你可以从Webbrowser访问WSDL吗? 尝试:
HTTPS://mywsdl?wsdl
你应该得到你的wsdl-XML。如果可行,则应检查在webbrowser中设置的证书。然后你必须确定哪个负责你的WSDL-Server,你应该在你的机器上安装这个证书。
或者也许有一种方法可以在ANT电话中设置它......我不知道......
祝你好运!