I am try开发者_StackOverflowing to generate a client jar from WSDL using an Ant buildfile like this:
<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>
But I'm getting this exception when I run 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.
Any pointers on how to fix this?
I think https://mywsdl
in <wsimport>
has to point to a valid WSDL document.
It seems like, your computer, where you run the ant script, doesn't have a proper certificate for the foreign Server. You are trying to access the WSDL via HTTPS, which may require a certificate installed. Can you access the WSDL from you Webbrowser? Try:
HTTPS://mywsdl?wsdl
And you should get your wsdl-XML. If that works, than you should check the certificates, that are set within your webbrowser. Then you have to determine, which of them are responsible for your WSDL-Server and you should install this Certificate on your machine.
Or maybe there is a way to set this in the ANT call... I dont know...
Good luck!
精彩评论