I apologise if this is a duplicate question - I looked for quite a file and found very many similar questions, but nothing quite the same as this.
I'm trying to generate Java client bindings using wsimport for a web service with the WSDL specified at this URL: https://api.dss.gov.au/datacollection/dex?wsdl However, I keep getting errors like this:
[ERROR] Premature end of file. line 1 of http://api.dss.gov.au/datacollection/dex?WSDL&type=XSD&file=file%3A%2FC%3A%2Ftfs%2FCCSApps%2FDataCollection%2FBranches%2FMR17.11%2FOSB%2FDataCollection.Assessment%2FResources%2FSchema%2FAssessment.External.xsd
[ERROR] org.xml.sax.SAXParseException; systemId: http://api.dss.gov.au/datacollection/dex?WSDL&type=XSD&file=file%3A%2FC%3A%2Ftfs%2FCCSApps%2FDataCollection%2FBranches%2FMR17.11%2FOSB%2FDataCollection.Assessment%2FResources%2FSchema%2FAssessment.External.xsd; lineNumber: 1; columnNumber: 1; Premature end of file. line 2 of https://api.dss.gov.au/datacollection/dex?wsdl
It is failing while trying to download/parse the very first schema file listed in the WSDL.
I am running this on Windows 10. I have tried JDK 1.8 and Java 9. I have tried generating it using the Eclipse Web Developer Tools, and by using the jaxws-maven-plugin, and by using wsimport directly - they all fail with the same error. So presumably the error is something to do with the core jax-ws implementation and not with any of the wrappers.
I have plugged the schema URL into my browser window (on the same machine as my dev) and verified that it downloads properly. At a glance it seems to be a well-formed schema file - it certainly isn't zero-length, as this error would imply.
Thinking perhaps this was a permissions issue, I tried the fixes suggested in this question: WebService Client Generation Error with JDK8 Unfortunately, they didn't work either.
I have tried downloading the WSDL and the offending schema file to my local dir and then updating the schema link in the WSDL to point to the local copy of the schema file. This does seem to fix the issue - however, it then fails on the next schema file. I started a manual process of downloading the schema file all locally and updating the links, but there seem to be dozens of schema files. It also doesn't seem to be a sustainable way of developing against this web service going forward if the API changes.
Answers to this could consist of any of the following:
- Show me what I am doing wrong to cause this error, and allow me to fix it to automatically generate the Java bindings from this WSDL.
- An a free alternative tool to wsimport to achieve the same functionality.
- Reference to a bug report for wsimport showing that this is a known issue that hasn't been resolved..